P1033 [NOIP 2002 Senior] Free Fall
Description
On a ceiling of height $H$, there are $n$ balls with negligible size, located at positions $0, 1, 2, \cdots, n-1$. On the ground there is a cart (length $L$, height $K$) at a distance $S_1$ from the origin. The falling distance of a ball is given by $d=0.5 \times g \times (t^2)$, where $g=10$ and $t$ is the falling time. The cart moves forward at speed $V$.
As shown in the figure:

The cart and all balls start moving at the same time. When the distance between a ball and the cart is $\le 0.0001$ (thanks to Silver_N for the correction), the ball is considered caught by the cart. A ball cannot be caught after it has reached the ground.
Please compute how many balls the cart can catch.
Source: NOIP 2002 Senior, Problem 3.
Input Format
A single line contains six integers $H, S_1, V, L, K, n$.
Constraints: $1 \le H, S_1, V, L, K, n \le 100000$.
Output Format
Output a single integer: the number of balls the cart can catch.
Explanation/Hint
If a ball falls into the rear end of the cart, it is considered to have fallen into the cart.
Translated by ChatGPT 5