URI-1018 Solve

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

Problem link: https://www.urionlinejudge.com.br/judge/en/problems/view/1018

Solution:

  • [tab]
    • C
      • #include <stdio.h>
        int main()
        {
            int n;
            scanf("%d", &n);
            printf("%d\n", n);
            printf("%d nota(s) de R$ 100,00\n", n/100);
            n %= 100;
            printf("%d nota(s) de R$ 50,00\n", n/50);
            n %= 50;
            printf("%d nota(s) de R$ 20,00\n", n/20);
            n %= 20;
            printf("%d nota(s) de R$ 10,00\n", n/10);
            n %= 10;
            printf("%d nota(s) de R$ 5,00\n", n/5);
            n %= 5;
            printf("%d nota(s) de R$ 2,00\n", n/2);
            n %= 2;
            printf("%d nota(s) de R$ 1,00\n", n);
            return 0;
        }
    • C++
      • #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;
        }
3/Technology/post-list
Name

Codeforces,53,Problem Solve,90,Programming Tricks,1,URI,37,
ltr
item
DorHubs: URI-1018 Solve
URI-1018 Solve
DorHubs
https://dorhubs.blogspot.com/2019/08/uri-1018-solve.html
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/
https://dorhubs.blogspot.com/2019/08/uri-1018-solve.html
true
9087637800571592252
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy