#include<stdio.h>
const int N=100;
int main()
{
int a,b,c=0;
for(a=0;a<=N;a++){
for(b=0;b<=N;b++){
for(c=0;c<=N;c++){
if(15*a+9*b+3*c==3*N&&c%3==0&&b>=0){
printf("鸡翁%d只,",a);
printf("鸡母%d只,",b);
printf("鸡雏%d只\n,",c);
}
}
}
}
return 0;
}
2.
#include<iostream>
using namespace std;
int main(){
int a,b,c;
for(a=0;a<=400;a++)
for(b=0;b<=666;b++)
for(c=0;c<=6000;c++)
if((a+b+c==2000)&&(5*a+3*b+c/3)==2000&&c%3==0)
cout<<"a="<<a<<" "<<"b="<<b<<" "<<"c="<<c<<endl;
return 0;
}
3.
#include <iostream>
using namespace std;
int main(){
int a,b,c;
for(a=0;a<=20;a++)
for(b=0;b<=33;b++){
c=100-a-b;
if((5*a+3*b+c/3)==100&&c%3==0)
cout<<"a="<<a<<" "<<"b="<<b<<" "<<"c="<<c<<endl;
}
return 0;
}