Python 实现

height = int(input())
total_distance = 0
rebound_height = 0
for i in range(5):
    if i != 0:
        total_distance += 2 * height
    else:
        total_distance += height
    height = height / 2
    rebound_height = height
print(total_distance)
print(rebound_height)