#Z14201. 球弹跳高度的计算
球弹跳高度的计算
Description
A ball falls from a certain height h (in meters). After each landing, it bounces back to half of its previous height before falling again.
Write a program to calculate the total distance traveled by the ball when it hits the ground for the 10th time, and the height of the 10th bounce. The output should consist of two lines:
- Line 1: The total distance traveled by the ball when it hits the ground for the 10th time.
- Line 2: The height of the 10th bounce.
Input Format
An integer h, representing the initial height of the ball.
Output Format
- Line 1: The total distance traveled by the ball when it hits the ground for the 10th time.
- Line 2: The height of the 10th bounce.
Note: The results may be real numbers and should be stored as typedouble.
Hint: No special precision control is needed for the output. You can usecout << ANSWERorprintf("%g", ANSWER).
20
59.9219
0.0195312