提交时间:2024-05-12 14:07:33
运行 ID: 47085
#include<bits/stdc++.h> using namespace std; int main() { int s=100; int g,m,x; //printf("5%c5%c5%c\n","公鸡","",""); cout<<std::left<<setw(5)<<"公鸡"; cout<<std::left<<setw(5)<<"母鸡"; cout<<std::left<<setw(5)<<"小鸡"; for(int i=1;i<=100/3;i++){ for(int j=1;j<=s-i;j++){ for(int k=1;k<=s-i;k++){ if(i*3+j*2+k/3==100&&(i+j+k)==100){ cout<<std::left<<setw(5)<<i; cout<<std::left<<setw(5)<<j; cout<<std::left<<setw(5)<<k; } } } } }