题解 | #百钱买百鸡问题#
百钱买百鸡问题
https://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b
#include <stdio.h> int main() { int a,b,c,e,f; // scanf("%d",&b); for(c=0;c<=20;c++)//公鸡 { for(e=0;e<=33;e++)//母鸡 { for(f=0;f<=300;f=f+3)//小鸡 { if((5*c+3*e+f/3)==100&&((c+e+f)==100)) { printf("%d ",c); printf("%d ",e); printf("%d\n",f); } } } } return 0; }