Skip to content

Commit ece99c9

Browse files
求小球落地5次后所经历的路程和第5次反弹的高度
1 parent d750126 commit ece99c9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

newcoder/HJ38.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'''
2+
Descripttion: 求小球落地5次后所经历的路程和第5次反弹的高度
3+
version: 1
4+
Author: Jason
5+
Date: 2020-11-20 14:02:19
6+
LastEditors: Jason
7+
LastEditTime: 2020-11-20 14:18:39
8+
'''
9+
altitude = int(input())
10+
distance = 0
11+
distance_rep = 0
12+
for _ in range(5):
13+
distance += altitude + distance_rep
14+
altitude = altitude / 2
15+
distance_rep = altitude
16+
print(distance)
17+
print(distance_rep)

0 commit comments

Comments
 (0)