Change P20368


Statement
 

pdf   zip

thehtml

Write a program that, given an amount of euros and cents, prints the minimal number of banknotes and coins needed to obtain that amount, knowing that there are coins of 1, 2, 5, 10, 20 and 50 cents and 1 and 2 euros, and banknotes of 5, 10, 20, 50, 100, 200 and 500 euros.

Input

Input is a real positive number with, at maximum, two decimals behind the comma.

Output

The output must indicate how many banknotes and coins of each type must be given to represent the amount of the input, being the number of banknotes and coins the minimum possible. Use the format of the examples.

Observation

Be careful with accuracy problems of real numbers!

Public test cases
  • Input

    9999.99
    

    Output

    Banknotes of 500 euros: 19
    Banknotes of 200 euros: 2
    Banknotes of 100 euros: 0
    Banknotes of 50 euros: 1
    Banknotes of 20 euros: 2
    Banknotes of 10 euros: 0
    Banknotes of 5 euros: 1
    Coins of 2 euros: 2
    Coins of 1 euro: 0
    Coins of 50 cents: 1
    Coins of 20 cents: 2
    Coins of 10 cents: 0
    Coins of 5 cents: 1
    Coins of 2 cents: 2
    Coins of 1 cent: 0
    
  • Input

    0.78
    

    Output

    Banknotes of 500 euros: 0
    Banknotes of 200 euros: 0
    Banknotes of 100 euros: 0
    Banknotes of 50 euros: 0
    Banknotes of 20 euros: 0
    Banknotes of 10 euros: 0
    Banknotes of 5 euros: 0
    Coins of 2 euros: 0
    Coins of 1 euro: 0
    Coins of 50 cents: 1
    Coins of 20 cents: 1
    Coins of 10 cents: 0
    Coins of 5 cents: 1
    Coins of 2 cents: 1
    Coins of 1 cent: 1
    
  • Input

    100
    

    Output

    Banknotes of 500 euros: 0
    Banknotes of 200 euros: 0
    Banknotes of 100 euros: 1
    Banknotes of 50 euros: 0
    Banknotes of 20 euros: 0
    Banknotes of 10 euros: 0
    Banknotes of 5 euros: 0
    Coins of 2 euros: 0
    Coins of 1 euro: 0
    Coins of 50 cents: 0
    Coins of 20 cents: 0
    Coins of 10 cents: 0
    Coins of 5 cents: 0
    Coins of 2 cents: 0
    Coins of 1 cent: 0
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Python