在一行上输入一个整数
代表小球的初始高度。
第一行输出一个实数,代表小球在第五次落地时所经历的路程。
第二行输出一个实数,代表第五次反弹的高度。
由于实数的计算存在误差,当误差的量级不超过
时,您的答案都将被接受。具体来说,设您的答案为
,标准答案为
,当且仅当
时,您的答案将被接受。
1
2.875 0.03125
第一次反弹高度为
米,第二次反弹高度为
米,第三次反弹高度为
米,第四次反弹高度为
米,第五次反弹高度为
米。
截止第五次落地,总路程为
米。
h = int(input()) sum = h n = 0 for i in range(1,5): n = h / 2 sum += 2*n h = n print(sum) print(n/2)
def solution(h): print(2.875*h) print(0.03125*h) solution(int(input()))
h = int(input()) s = 0 for i in range(2,6): s += 0.5**(i-1)*2*h print(s+h) print(0.5**5*h)
ip = int(input()) print(ip*(1+1+2+2+4+4+8+8+16)/16) print(ip/32)
while True: try: init_height = float(input()) total = init_height*(2+7/8) last = init_height/32 print(f'{total:.6f}') print(f'{last:.6f}') except: break
#模拟求解,最后一段路程不算弹起距离,所以要减去 height = int(input()) count = 0 distance = 0 bounce_height = height while count < 5: distance += bounce_height bounce_height = 0.5* bounce_height distance += bounce_height count += 1 distance -= bounce_height print(distance) print(bounce_height)
define_1 = 1+0.5+0.5**2+0.5**3+0.5**4 define_2 = 0.5**5 while True: try: count = int(input()) output_1 = 2 * define_1 * count - count print(output_1) output_2 = count * define_2 print(output_2) except: break