python/公开课/文档/第05次公开课-算法入门系列1-周而复始/code/example05.py
2024-12-04 00:04:56 +08:00

10 lines
291 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
公鸡5元一只母鸡3元一只小鸡1元三只用100元买一百只鸡问公鸡、母鸡、小鸡各有多少只
"""
for x in range(21):
for y in range(34):
z = 100 - x - y
if z % 3 == 0 and 5 * x + 3 * y + z // 3 == 100:
print(x, y, z)