在这个问题中,你需要读取一个整数值并将其分解为多张钞票的和,每种面值的钞票可以使用多张,并要求所用的钞票数量尽可能少。
请你输出读取值和钞票清单。
钞票的可能面值有100,50,20,10,5,2,1。
输入格式:
输入一个整数n(0<n<1000000)。
输出格式:
参照输出样例,输出读取数值以及每种面值的钞票的需求数量。
输入样例:
326
输出样例:
326
3 nota(s) de R$ 100,00
0 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
#include<bits/stdc++.h>
using namespace std;
int f[]={100,50,20,10,5,2,1};
int main()
{
int n;
cin>>n;
cout<<n<<endl;
for(int i=0;i<7;i++)
{
printf("%d nota(s) de R$ %d,00\n",n/f[i],f[i]);
n %= f[i];//每次取余数
}
return 0;
}