13:人民币支付

13:人民币支付

总时间限制: 
1000ms
 
内存限制: 
65536kB
描述

从键盘输入一指定金额(以元为单位,如345),然后输出支付该金额的各种面额的人民币数量,显示100元,50元,20元,10元,5元,1元各多少张,要求尽量使用大面额的钞票。

输入
一个小于1000的正整数。
输出
输出分行,每行显示一个整数,从上到下分别表示100元,50元,20元,10元,5元,1元人民币的张数
样例输入
735
样例输出
7
0
1
1
1
0

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<queue>
 4 #include<cmath>
 5 using namespace std;
 6 int main() 
 7 {
 8     int n;
 9     cin>>n;
10     cout<<n/100<<endl;//100
11     n=n%100;
12     cout<<n/50<<endl;//100
13     n=n%50;
14     cout<<n/20<<endl;//100
15     n=n%20;
16     cout<<n/10<<endl;//100
17     n=n%10;
18     cout<<n/5<<endl;//100
19     n=n%5;
20     cout<<n/1<<endl;//100
21     n=n%1;
22     return 0;
23 }
原文地址:https://www.cnblogs.com/zwfymqz/p/6502831.html