题目描述
代码太繁琐了,想不到怎么优化
样例
#include<stdio.h>
int main()
{
int N,a,b,c,d,e,f,g;
scanf("%d",&N);
printf("%d",N);
a=N/100;
printf("%d nota(s) de R$ 100,00\n",a);
N=N%100;
b=N/50;
printf("%d nota(s) de R$ 50,00\n",b);
N=N%50;
c=N/20;
printf("%d nota(s) de R$ 20,00\n",c);
N=N%20;
d=N/10;
printf("%d nota(s) de R$ 10,00\n",d);
N=N%10;
e=N/5;
printf("%d nota(s) de R$ 5,00\n",e);
N=N%5;
f=N/2;
printf("%d nota(s) de R$ 2,00\n",f);
g=N%2;
printf("%d nota(s) de R$ 1,00\n",g);
return 0;
}
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla