源程序:
day = 10
while True:
m = day
flag = True
for i in range(9):
if m % 2 == 0:
m = m - m//2 - 1
else:
flag = False
break
if m == 1 and flag:
break
day = day + 1
print("第一天桃子的数量是:", day)
for i in range(9):
print(i+1, day, "->", day-day//2-1)
day = day - day//2 - 1
运行结果:
标签:break,吃桃,range,猴子,问题,flag,True,day From: https://www.cnblogs.com/duanqibo/p/18100757