13:人民币支付

时间:2022-05-07
本文章向大家介绍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 }