[cpp] #include<iostream> using namespace std; int main() { int i,j,k; int x,y,z; cout<<"100錢能買:"<<endl; for(x=0;x<=20;x++) for(y=0;y<=33;y++) for(z=0;z<=300;z++) { if(5*x+3*y+z/3==100 && x+y+z==100) cout<<x<<"只雞翁"<<y<<"只雞母"<<z<<"只雞雛"<<endl; } return 0; }