百钱百鸡.py 402 B

1234567891011
  1. for x in range(0,21):
  2. for y in range(0,34):
  3. z = 100-x-y
  4. if 5*x+3*y+1*z/3==100:
  5. x1=str(x)
  6. y1=str(y)
  7. z1=str(z)
  8. output1=x1+"只,"
  9. output2=y1+"只,"
  10. output3=z1+"只"
  11. print("公鸡:",output1,"母鸡:",output2,"小鸡:",output3)