Bringing It Home

0

0 votes
Problem

Last time, Dominic and his family brought it home, to the city they know best. After a fierce battle with Shaw in the town, the town gained a lot of heat. In order to calm things down, the police in town are working on improving the traffic capacity of the road, the town's mayor ordered to place on traffic sign, thus limiting the maximum speed. The traffic signs in the town seem to be a bit odd. The reason being, they only limit the speed where the traffic signals are placed and just after passing the sign the cars are allowed to drive at any speed.

It is given that the cars of the town have an average acceleration/deceleration of x km/h^2, and has a maximum speed of y km/h. The road has the length of L km, and the speed sign, limiting the speed to w km/h, is placed d km (1 <= d <= L) away from the town. You have to find the minimum time that an average car will need to get from the town, if the car drives at the optimal speed.

Note: The car has a zero speed at the beginning of the journey.

Input: The first line of the input file contains two integer numbers x and y (1 <= x, y <= 10000). The second line contains three integer numbers L, d and w (2 <= L <= 10000; 1 <= d < L; 1 <= w <= 10000).

Output: Print the answer with nine digits after the decimal point.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?