day33 归并排序

day33 归并排序_第1张图片
image.png

五人分鱼问题:

def main():
    fish = 1
    while True:
        total, enough = fish, True
        for _ in range(5):
            if (total - 1) % 5 == 0:
                total = (total - 1) // 5 *4
            else:
                enough = False
                break
        if enough:
            print(f'总共有{fish}条鱼')
            break
        fish += 1


if __name__ == '__main__':
    main()

你可能感兴趣的:(day33 归并排序)