题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
求小球落地5次后所经历的路程和第5次反弹的高度
https://www.nowcoder.com/practice/2f6f9339d151410583459847ecc98446
n = int(input())
ground=n
skip=0
def skip(n):
return (1/2)**n*ground
def total(n):
t=0
for i in range(1,n):
t+=skip(i)*2
return t+ground
print(total(5),skip(5),sep='\n')
ground=n
skip=0
def skip(n):
return (1/2)**n*ground
def total(n):
t=0
for i in range(1,n):
t+=skip(i)*2
return t+ground
print(total(5),skip(5),sep='\n')
