bigmouse = 1 smallmouse = 1 day = 0 time = 1 big, small = 0,0 wall = int(input()) while wall > 0: if wall - bigmouse - smallmouse < 0: time = wall / (smallmouse + bigmouse) day = day + 1 big = big + time * bigmouse small = small + time * smallmouse wall = wall - bigmouse - smallmouse bigmouse = bigmouse * 2 smallmouse = smallmouse / 2 print(day) print(f'{small:.1f}', end=' ') print(f'{big:.1f}')
python 二鼠打洞问题
最新推荐文章于 2024-03-05 22:19:06 发布