0030. Planet Lob

Input file name: plob.in
Output file name: plob.out
Time limit: 2 s
Memory limit: 64 megabytes

Somewhere in the universe a planet called "Lob" is located. This planet is very strange. Its inhabitants consider the surface of their planet as a part of the plane with y coordinates greater than 0. Also the strangest property of this planet is that the velocity of any object moving on the surface of planet is equal to its y-coordinate in any moment. So the velocity will be constant only if y-coordinate is constant.

Inhabitants of the planet have built a car which automatically selects the fastest path between two points. So your task is to calculate the minimal amount of travelling time between two points on the surface.

Input file

The input file contains 4 integer numbers x1 y1 x2 y2 where all coordinates do not exceed 100000000 by absolute value. yi are guaranteed to be positive.

Output file

You have to output only one real number – time the car will travel from one point to another. The number must be written with 8 digits after the decimal point.


0 1 0 10.00000000

Source: Petrozavodsk training camp, Summer 2002. Startup contest
Author: Andrew Lopatin, Nick Durov

Discuss       Submit a solution

Printable version