题目:5个人(ABCDE)晚上捕鱼
A - 把鱼分成5份扔掉多的1条拿走自己那份
B - 把鱼分成5份扔掉多的1条拿走自己那份
C- 把鱼分成5份扔掉多的1条拿走自己那份
D- 把鱼分成5份扔掉多的1条拿走自己那份
E- 把鱼分成5份扔掉多的1条拿走自己那份
求最少捕了多少条鱼?
假设捕了x条鱼
那么(x -1) % 5 == 0
剩下的鱼为(x-1) // 5*4 =
def main():
fish = 1
total = fish
while True:
is_enouge = Ture
for _ in range(5):
if (total-1) %5 == 0:
total = (total-1) //5 *4
else:
is_enough = False
break
if is_enough:
print("总共有%d条鱼,%fish')
break
fish += 1