题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
求小球落地5次后所经历的路程和第5次反弹的高度
https://www.nowcoder.com/practice/2f6f9339d151410583459847ecc98446
h = int(input()) l = [] n = 5 while n >= 0: l.append(h) h = h/2 n -= 1 print(l[0] + 2 * sum(l[1:5])) print(l[-1])
求小球落地5次后所经历的路程和第5次反弹的高度
https://www.nowcoder.com/practice/2f6f9339d151410583459847ecc98446
h = int(input()) l = [] n = 5 while n >= 0: l.append(h) h = h/2 n -= 1 print(l[0] + 2 * sum(l[1:5])) print(l[-1])
相关推荐