Algorithm


Problem Name: beecrowd | 1018

Banknotes

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

In this problem you have to read an integer value and calculate the smallest possible number of banknotes in which the value may be decomposed. The possible banknotes are 100, 50, 20, 10, 5, 2 e 1. Print the read value and the list of banknotes.

Input

The input file contains an integer value N (0 < N < 1000000).

Output

Print the read number and the minimum quantity of each necessary banknotes in Portuguese language, as the given example. Do not forget to print the end of line after each line, otherwise you will receive “Presentation Error”.

Input Sample Output Sample

576

576
5 nota(s) de R$ 100,00
1 nota(s) de R$ 50,00
1 nota(s) de R$ 20,00
0 nota(s) de R$ 10,00
1 nota(s) de R$ 5,00
0 nota(s) de R$ 2,00
1 nota(s) de R$ 1,00

 

11257

11257
112 nota(s) de R$ 100,00
1 nota(s) de R$ 50,00
0 nota(s) de R$ 20,00
0 nota(s) de R$ 10,00
1 nota(s) de R$ 5,00
1 nota(s) de R$ 2,00
0 nota(s) de R$ 1,00

 

503

503
5 nota(s) de R$ 100,00
0 nota(s) de R$ 50,00
0 nota(s) de R$ 20,00
0 nota(s) de R$ 10,00
0 nota(s) de R$ 5,00
1 nota(s) de R$ 2,00
1 nota(s) de R$ 1,00

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>
int main(){
    int notes, aux;

    scanf("%d", ¬es);

    printf("%d\n", notes);
    printf("%d nota(s) de R$ 100,00\n", notes/100);
    aux = (notes%100);
    printf("%d nota(s) de R$ 50,00\n", aux/50);
    aux = (aux%50);

    printf("%d nota(s) de R$ 20,00\n", aux/20);
    aux = (aux%20);

    printf("%d nota(s) de R$ 10,00\n", aux/10);
    aux = (aux%10);

    printf("%d nota(s) de R$ 5,00\n", aux/5);
    aux = (aux%5);

    printf("%d nota(s) de R$ 2,00\n", aux/2);
    aux = (aux%2);

    printf("%d nota(s) de R$ 1,00\n", aux/1);
    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
576

Output

x
+
cmd
576 5 nota(s) de R$ 100,00 1 nota(s) de R$ 50,00 1 nota(s) de R$ 20,00 0 nota(s) de R$ 10,00 1 nota(s) de R$ 5,00 0 nota(s) de R$ 2,00 1 nota(s) de R$ 1,00

#2 Code Example with C++ Programming

Code - C++ Programming



#include <iostream>

using namespace std;

int main(){
    int inteiro, aux;
    
    cin >> inteiro;
    
    cout << inteiro <<"\n";
    cout << inteiro/100 << " nota(s) de R$ 100,00\n";

    aux = (inteiro%100);

    cout << aux/50 << " nota(s) de R$ 50,00\n";
    aux = (aux%50);

    cout << aux/20 << " nota(s) de R$ 20,00\n";
    aux = (aux%20);

    cout << aux/10 << " nota(s) de R$ 10,00\n";
    aux = (aux%10);

    cout << aux/5 << " nota(s) de R$ 5,00\n";
    aux = (aux%5);

    cout << aux/2 << " nota(s) de R$ 2,00\n";
    aux = (aux%2);

    cout << aux/1 << " nota(s) de R$ 1,00\n";
    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
11257

Output

x
+
cmd
11257 112 nota(s) de R$ 100,00 1 nota(s) de R$ 50,00 0 nota(s) de R$ 20,00 0 nota(s) de R$ 10,00 1 nota(s) de R$ 5,00 1 nota(s) de R$ 2,00 0 nota(s) de R$ 1,00
Advertisements

Demonstration


Previous
#1016 Beecrowd Online Judge Solution 1016 Distance Solution in C, C++, Java, Python and C#
Next
#1019 Beecrowd Online Judge Solution 1019 Time Conversion Solution in C, C++, Java, Python and C#