Minimum change

Write a program that, given an amount of euros and cents, computes the minimum number of banknotes and coins needed to get that amount. There are coins of 1, 2, 5, 10, 20 and 50 cents and of 1 and 2 euros, and banknotes of 5, 10, 20, 50, 100, 200 and 500 euros.

Input

Input consists of two natural numbers: the number of euros ee and the number of cents cc. Assume c<100c<100.

Output

Print the number of banknotes and coins of each type that are are needed to represent the amount of the input, so as to minimize the total number of banknotes and coins.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:54:41.077Z

© Jutge.org, 2006–2026.
https://jutge.org