UVa 10868 - Bungee Jumping

10868 - Bungee Jumping

 * http://acm.uva.es/p/v108/10868.html

Summary
Physics problem.

Explanation
Let $$\Delta_l$$ be the increase of rope length and $$v$$ the speed when Bond reaches the ground, then by conservation of energy we have $$wgs = k \Delta l^2/2 + w v^2/2$$, where $$g=9.81$$. Notice that $$\Delta l = 0$$ if $$s < l$$, and $$s-l$$ otherwise.

Gotchas

 * Take care of the case when $$s < l$$.

Input
350 20 30 75 375 20 30 75 400 20 30 75 425 20 30 75 450 20 30 75 400 20 30 50 400 20 30 80 400 20 30 85 100 20 1 80 0 0 0 0

Output
Killed by the impact. James Bond survives. James Bond survives. James Bond survives. Stuck in the air. Stuck in the air. James Bond survives. Killed by the impact. James Bond survives.