分鱼
"""
穷举法:穷尽所有可能直到找到正确答案
"""
def main():
"""分鱼"""
fish = 1
while True:
enough = True
total = fish
for _ in range(5):
if (total - 1) % 5 == 0:
total = (total - 1) // 5 *4
else:
enough = False
break
if enough:
print(fish)
break
fish += 1
if __name__ == "__main__":
main()
穷举法
"""穷举法"""
def main():
"""主函数"""
for cock in range(0, 21):
for hen in range(0, 34):
chick = 100 - cock - hen
if chick % 3 == 0 and cock * 5 + hen * 3 + chick // 3 == 100:
print(f"公鸡: {cock}只, 母鸡: {hen}只, 小鸡: {chick}只")
if __name__ == "__main__":
main()