336. Vending Machine Change
EasyGreedy
A drink costs c rupees and you pay p rupees. Print the change using coins of 10, 5, 2 and 1 as count10 count5 count2 count1 (greedy), or INSUFFICIENT if p < c.
Input format
A single line: c p
Output format
Four counts, or INSUFFICIENT.
Example 1
Input
37 100
Output
6 0 1 1
Example 2
Input
50 50
Output
0 0 0 0
Constraints
1 ≤ c, p ≤ 10⁶
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…