使用穷举法
定义x,y,z分别为对兑换的1元2元5元张数
且每种都存在,从1开始列举
#include<stdio.h>
int main(){
int n,x,y,z,num=0;
printf("select 100 50 20 10 as the num :" );
scanf("%d",&n);
for(x=1;x<=n;x++){
for(y=1;y<=n/2;y++){
for(z=1;z<=n/5;z++){
if(x+y*2+z*5==n)
num++;
}
}
}
printf("the choice is %d",num);
return 0;
}