33,319
社区成员
发帖
与我相关
我的任务
分享// 1118ABCchicken.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int x=0,y=0,z=0;
cout<<"公鸡为x: 母鸡为y: 小鸡为z:"<<endl;
for(x=0;x<=20;x++)
{
for(y=0;y<=33;y++)
{
for(z=0;z<=100;z=z+3)
{
if((x+y+z==100) && (5*x+3*y+z/3==100))
cout<<"x="<<x<<"\t\t"<<"y="<<y<<"\t\t"<<"z="<<z<<endl;
}
}
}
fflush(stdin);
getchar();
return 0;
}