题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#
求小球落地5次后所经历的路程和第5次反弹的高度
http://www.nowcoder.com/practice/2f6f9339d151410583459847ecc98446
import sys while True: try: h = float(input()) s = h for i in range(4): s += h #弹起和落下都是1/2高度 h /= 2 s = "%0.6f"%s h = "%0.6f"%(h / 2) print(s.rstrip('0')) print(h.rstrip('0')) except: # print(sys.exc_info()) break