100元兑换

来源:互联网 发布:大屏幕电子书 知乎 编辑:程序博客网 时间:2024/04/30 11:52

100元兑换成10、5、1元,要求每种兑法都有10、5、1元;

#include<iostream>#include<iomanip>using namespace std;int main(){for(int i=1;i<<10;i++)  for(int j=1;j<<18;j++)     for(int k=1;k<=95;k++)       if(10*i+5*j+k==100)          {cout<<"i: "<<setw(2)<<setfill(' ')<<i;  cout<<"  j: "<<setw(2)<<setfill(' ')<<j;  cout<<"  k: "<<setw(2)<<setfill(' ')<<k<<endl;}} 


原创粉丝点击