#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    // a公鸡最多20只,b母鸡最多33只,c小鸡每次+3保证是3的倍数
    for(a=0;a<=20;a++)
    {
        for(b=0;b<=33;b++)
        {
            for(c=0;c<=100;c=c+3)
            {
                if(a+b+c==100 && a*5+b*3+c/3==100)
                {
                    cout<<"公鸡:"<<a<<" 母鸡:"<<b<<" 小鸡:"<<c<<endl;
                }
            }
        }
    }
    return 0;                    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: