使用C++将一元钱换成1分,2分和5分硬币,每种硬币的个数大于0,且为5的倍数,编写程序并计算几种换法
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int count=0;
/**********Program**********/
int x,y,z;
for(x=5;x<=100;x+=5)
for(y=5;y<=50;y+=5)
for(z=5;z<=20;z+=5)
if(x+2*y+5*z==100){
count ++;
}
/********** End **********/
cout << "共有" << count << "种换法。" << endl;
//忽略阅读
//忽略阅读结束
return 0;
}