AcWing 653. 钞票
原题链接
中等
作者:
noobcoder
,
2020-02-27 15:07:22
,
所有人可见
,
阅读 1478
#include <iostream>
using namespace std;
int main(){
int n,a,b,c,d,e,f,g;
cin>>n;
a=n/100;
b=(n-a*100)/50;
c=(n-a*100-b*50)/20;
d = (n-a*100-b*50-c*20)/10;
e = (n-a*100-b*50-c*20-d*10)/5;
f = (n-a*100-b*50-c*20-d*10-e*5)/2;
g = (n-a*100-b*50-c*20-d*10-e*5-f*2)/1;
cout<<n<<endl;
printf("%d nota(s) de R$ 100,00\n",a);
printf("%d nota(s) de R$ 50,00\n",b);
printf("%d nota(s) de R$ 20,00\n",c);
printf("%d nota(s) de R$ 10,00\n",d);
printf("%d nota(s) de R$ 5,00\n",e);
printf("%d nota(s) de R$ 2,00\n",f);
printf("%d nota(s) de R$ 1,00\n",g);
return 0;
}
#include[HTML_REMOVED]
#include[HTML_REMOVED]
#include[HTML_REMOVED]
using namespace std;
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/1);
}//这样会不会方便一点