PROBLEM 19
Easy

ATM Banknote Count

Programming Basics · Java

</>
STATUS Not solved

TASK

Problem

#19

Read an amount divisible by 100. Using banknotes 1000, 500, 200 and 100, print the minimum number of banknotes needed.

EXAMPLE

Example

Input
2800
Output
5

LIMITS

Constraints

0 ≤ amount ≤ 10^9; amount is divisible by 100
📖
LEARN Theory for this problem
+

The core idea of **ATM Banknote Count** is to model the requested operation directly: Read an amount divisible by 100. Using banknotes 1000, 500, 200 and 100, print the minimum number of banknotes needed. The reference solution uses `Scanner` for input. Keep only the state needed for this result, choose numeric types that cover the stated bounds, and preserve the exact input/output contract. This makes the solution easier to verify on boundary cases and avoids unrelated work.

💡
NEED HELP? Hints
+

['Follow the statement for **ATM Banknote Count** literally and identify the smallest state needed to produce its output.', 'The reference solution relies on `Scanner` for input; test the smallest allowed input and one boundary case from the constraints.']

ANSWER Solution
+
// CodeMaster — ATM Banknote Count
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int amount = sc.nextInt();
        int count = 0;
        count += amount / 1000;
        amount %= 1000;
        count += amount / 500;
        amount %= 500;
        count += amount / 200;
        amount %= 200;
        count += amount / 100;
        System.out.println(count);
    }
}