#T793. 球弹跳高度的计算

球弹跳高度的计算

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 the ball has traveled by the 10th landing and the height of the 10th bounce.

The output consists of two lines:

  • Line 1: The total distance traveled by the ball when it lands for the 10th time.
  • Line 2: The height of the 10th bounce.

Input Format

Input an integer h, representing the initial height of the ball.

Output Format

  • Line 1: The total distance traveled by the ball when it lands for the 10th time.
  • Line 2: The height of the 10th bounce.

Note: The result may be a real number, so use the double type to store it.

Hint: No special precision control is needed for the output. You can use cout << ANSWER or printf("%g", ANSWER).

20
59.9219
0.0195312

翻译结果

CodesOnline