Sinkhole
Time limit1sMemory limit512 MB
A stone bounces between the walls of a hole with its horizontal speed dropping to 80% on each wall hit and its vertical fall restarting; count wall hits before it reaches depth D.
- Level
Medium6 of 10
- Topics
- Math, Simulation, Implementation
- Solved
- No attempts yet
Problem
There is a sinkhole at the center. To measure its depth, a stone is dropped from above the hole.
The stone starts at one edge above the hole and moves toward the opposite wall with initial horizontal speed . Its initial vertical velocity is . There is no air resistance and gravity is . Hence after its vertical velocity is reset to , the distance it free-falls in time is where is in and is in .
The hole has width . Whenever the stone hits a side wall, its vertical velocity becomes so the fall restarts, and its horizontal speed keeps only of its pre-impact magnitude while its direction reverses. Apart from the instant of impact, the horizontal speed stays constant. The stone is small enough to treat as a point.
Given the true depth of the hole, compute how many times the stone hits a wall before it reaches depth .
Input
The first line contains three integers , and separated by spaces. is the initial horizontal speed in , is the width of the hole in , and is the true depth of the hole in .
Constraints:
- is an integer with .
- is an integer with .
- is an integer with .
Output
Print the number of times the stone hits a side wall, on one line.
Hint
The horizontal speed is constant except at the instant it hits a wall. Inputs where the stone would reach the bottom at exactly the same moment as a wall impact are not given, so simultaneous impacts with the floor and a wall do not need to be handled.