题解 | #百鸡问题#
百鸡问题
http://www.nowcoder.com/practice/01d161052db64c249a47fc723b4fd5db
include <stdio.h>
main()
{
int x,y,z,n;
scanf("%d",&n);
for(x=0;x<=100;x++)
{
for(y=0;y<=100;y++)
{
for(z=0;z<=100;z++)
{
if((x15+y9+z<=3*n)&&(x+y+z==100))
{
printf("x=%d,y=%d,z=%d\n",x,y,z);
}
}
}
}
}