题目描述
主要就是注意最后一个数据
样例
#include <iostream>
using namespace std;
#include <math.h>
int main(){
double n;
cin >> n;
int a = n / 100;
int b = (n - a*100) / 50;
int c = (n - a*100 - b*50) / 20;
int d = (n - a*100 - b*50 - c*20) / 10;
int e = (n - a*100 - b*50 - c*20 - d*10) / 5;
int f = (n - a*100 - b*50 - c*20 - d*10 - e*5) / 2;
int g = (n - a*100 - b*50 - c*20 - d*10 - e*5 - f*2) / 1;
int h = (n - a*100 - b*50 - c*20 - d*10 - e*5 - f*2 - g) / 0.5;
int i = (n - a*100 - b*50 - c*20 - d*10 - e*5 - f*2 - g - h*0.5) / 0.25;
int j = (n - a*100 - b*50 - c*20 - d*10 - e*5 - f*2 - g - h*0.5 - i*0.25) / 0.10;
int k = (n - a*100 - b*50 - c*20 - d*10 - e*5 - f*2 - g - h*0.5 - i*0.25 - j*0.10) / 0.05;
double l = (n - a*100 - b*50 - c*20 - d*10 - e*5 - f*2 - g - h*0.5 - i*0.25 - j*0.10 - k*0.05) / 0.01;
cout << "NOTAS:" << endl;
cout << a << " nota(s) de R$ 100.00" << endl;
cout << b << " nota(s) de R$ 50.00" << endl;
cout << c << " nota(s) de R$ 20.00" << endl;
cout << d << " nota(s) de R$ 10.00" << endl;
cout << e << " nota(s) de R$ 5.00" << endl;
cout << f << " nota(s) de R$ 2.00" << endl;
cout << "MOEDAS:" << endl;
cout << g << " moeda(s) de R$ 1.00" << endl;
cout << h << " moeda(s) de R$ 0.50" << endl;
cout << i << " moeda(s) de R$ 0.25" << endl;
cout << j << " moeda(s) de R$ 0.10" << endl;
cout << k << " moeda(s) de R$ 0.05" << endl;
cout << round(l) << " moeda(s) de R$ 0.01" << endl;
return 0;
}
加倍快乐啊/doge