DMOPC '14 Contest 7 P1 - Flare

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Stranded on an island, Tusk decides to launch a signalling flare, but forgets to angle it towards the water. As a result, it takes off perpendicular to the ground. Its height y in relation to its initial velocity v, Earth's gravitation g=-9.8\dfrac{m}{s^2} and time t given as:

\displaystyle y = vt + \frac{1}{2}gt^2

If Ange launches the flare from the ground where y=0 at time t=0, how long does Ange have to get out of the way before the flare comes burning down?

Input Specification

A single integer, v (1 \le v \le 10^9).

Output Specification

The time elapsed until the flare touches the ground, i.e. the value of t > 0 such that the expression evaluates to 0. Your answer will be considered correct if it is within an absolute or relative error of 10^{-6}.

Sample Input

10

Sample Output

2.040816

Explanation of Output for Sample Input

Substituting in 2.040816 for t, we find that 10 \times 2.040816 + \dfrac{1}{2} \times (-9.8) \times (2.040816)^2 \approx 0.

Here is a displacement-time graph of the flare:


Comments


  • 0
    sas5580  commented on May 5, 2015, 4:07 p.m.

    First paragraph says Tusk, second says Ange