题解 | 求小球落地5次后所经历的路程和第5次反弹的高度
def five_height(m):
high = int(m) # 初始高度
total_distance = high # 总路程初始化为初始高度
rebound_height = high / 2 # 第一次反弹高度
for i in range(1, 6): # 计算五次落地的路程
if i < 5: # 最后一次落地不计算反弹
total_distance += 2 * rebound_height # 每次落地和反弹的路程
rebound_height /= 2 # 每次反弹的高度是上一次的一半
rebound_heightf = rebound_height*2 #最后一次的高度
return total_distance, rebound_heightf
m = int(input().strip()) # 读取输入并转换为整数
total_distance, rebound_height = five_height(m)
print(total_distance)
print(rebound_height)


