提交时间:2024-05-12 14:03:45
运行 ID: 47082
#include<bits/stdc++.h> using namespace std; int main(){ int g,m,x; cout<<std::left<<setw(5)<<"公鸡"; cout<<std::left<<setw(5)<<"母鸡"; cout<<std::left<<setw(5)<<"小鸡"<<endl; for(int i = 1;i<=100/3;i++){ for(int j = 1;j<=100-i;j++){ for(int k = 1;k<=100-i-j;k++){ if((i*3+j*2+k/3)==100&&(i+j+k)==100&&k%3==0){ cout<<std::left<<setw(5)<<i; cout<<std::left<<setw(5)<<j; cout<<std::left<<setw(5)<<k<<endl; } } } } return 0; }