Solar rocket

At a planet far away, an alien civilization is developing a rocket that
works with solar energy. Assume this simplified model: The rocket is a
point that moves vertically. Due to gravity, there is a constant
downward acceleration of a everywhere. At the rocket location, there are
h hours of daytime, followed by h hours of nighttime, followed by h
hours of daytime, etc. During the daytime hours, the solar engines of
the rocket provide an upward acceleration of b. Will the rocket reach a
vertical distance of d ? If so, can you compute the first time to reach
that point?

Input

Input consists of several cases, each with a, b, h and d. Assume that a
and b are real numbers such that 1 ≤ a < b ≤ 10, that h is an integer
number between 1 and 20, that d is an integer number between 1 and
10000, and that all the units used are km and hours.

Output

For every case, print “never” if the rocket will never reach height d.
Otherwise, print the minimum time to reach that height, with four digits
after the decimal point. The input cases have no precision issues, nor
ill-conditioned cases. With the given cases, the answer will never be
larger that 200 hours.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:19:24.550Z

© Jutge.org, 2006–2026.
https://jutge.org
