题目描述
笑死啦有的是力气和手段
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
int n,a,b,c,d,e,f,g;
cin>>n;
a=n/100;
b=n%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;
printf("%d\n%d nota(s) de R$ 100,00\n%d nota(s) de R$ 50,00\n%d nota(s) de R$ 20,00\n%d nota(s) de R$ 10,00\n%d nota(s) de R$ 5,00\n%d nota(s) de R$ 2,00\n%d nota(s) de R$ 1,00\n",n,a,b,c,d,e,f,g);
return 0;
}
循环的苗头
blablabla
时间复杂度
参考文献
C++ 代码
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
int n,a,b,c,d,e,f,g;
cin>>n;
a=n/100;
b=n%100/50;
c=n%100%50/20;
d=n%100%50%20/10;
e=n%100%50%20%10/5;
f=n%100%50%20%10%5/2;
g=n%100%50%20%10%5%2;
printf("%d\n%d nota(s) de R$ 100,00\n%d nota(s) de R$ 50,00\n%d nota(s) de R$ 20,00\n%d nota(s) de R$ 10,00\n%d nota(s) de R$ 5,00\n%d nota(s) de R$ 2,00\n%d nota(s) de R$ 1,00\n",n,a,b,c,d,e,f,g);
return 0;
}
循环和数组
blablabla
时间复杂度
参考文献
C++ 代码
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
int mianzhi[7]={100,50,20,10,5,2,1};
int n,i;
cin>>n;
printf("%d\n",n);
for(i=0;i<=6;i++){
printf("%d nota(s) de R$ %d,00\n",n/mianzhi[i],mianzhi[i]);
n%=mianzhi[i];
}
return 0;
}