Solution | URI Online Judge | 1018 Banknotes

URI Online Judge | 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 (0 < < 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 SampleOutput Sample
576576
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
1125711257
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
503503
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

সল্যুশন্সঃ 
#include<iostream>

using namespace std;

main()
{
    int N;

    cin >> N ;

    int quotient100 = N/100;
    int quotient50 = (N-(quotient100*100))/50;
    int quotient20 = ((N -(quotient50*50)-(quotient100*100))/20);
    int quotient10 = ((N -(quotient20*20)-(quotient50*50)-(quotient100*100))/10);
    int quotient5 = ((N -(quotient10*10)-(quotient20*20)-(quotient50*50)-(quotient100*100))/5);
    int quotient2 = ((N -(quotient5*5)-(quotient10*10)-(quotient20*20)-(quotient50*50)-(quotient100*100))/2);
    int quotient1 = ((N -(quotient2*2) -(quotient5*5)-(quotient10*10)-(quotient20*20)-(quotient50*50)-(quotient100*100))/1);

    cout << N << endl;
    cout << quotient100 << " nota(s) de R$ 100,00" << endl;
    cout << quotient50 << " nota(s) de R$ 50,00" << endl;
    cout << quotient20 << " nota(s) de R$ 20,00" << endl;
    cout << quotient10 << " nota(s) de R$ 10,00" << endl;
    cout << quotient5 << " nota(s) de R$ 5,00" << endl;
    cout << quotient2 << " nota(s) de R$ 2,00" << endl;
    cout << quotient1 << " nota(s) de R$ 1,00" << endl;

    return 0;
}


আলোচনাঃ 
কোনো টপিক না বুঝলে অবশ্যই কমেন্টস করবেন। কোড কপি পেষ্ট না করে আগে বুঝুন দেন নিজে নিজে করুন। কোডিং এর মজা টা বুঝবেন।

Comments

Popular posts from this blog

Solution - Codeforces Problem 327B - Hungry Sequence

Solution - Timus Problem 1293. Eniya

Solution - Timus Problem 1409. Two Gangsters