fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int x,y,z;
  6. for(x=0;x<=20;x++)
  7. {
  8. for(y=0;y<=33;y++)
  9. {
  10. for(z=0;z<=300;z=z+3)
  11. {
  12. if(5*x+3*y+z/3==100&&x+y+z==100)
  13. {
  14. printf("公鸡%d只,母鸡%d只,小鸡%d只",x,y,z);
  15. }
  16. }
  17. }
  18. }
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
公鸡0只,母鸡25只,小鸡75只公鸡4只,母鸡18只,小鸡78只公鸡8只,母鸡11只,小鸡81只公鸡12只,母鸡4只,小鸡84只