
ZOJ Problem Set  2340
Little frog Georgie likes to jump. Recently he have discovered the new playground that seems the perfect place to jump. Recently the new jumping exercise has become very popular. Two vertical walls are placed on the playground, each of which has a hole. The lower sides of the holes in the walls are on heights b_{1} and b_{2} respectively, and upper sides on heights t_{1} and t_{2}. Walls are parallel and placed on distance l from each other. The jumper starts at the distance ds from the first wall. It jumps through the first hole and lands between the walls. After that from that point he jumps through the second hole. The goal is to land exactly at the distance df from the second wall. Let us describe the jump. The jumper starts from the specified point and starts moving in some chosen direction with the speed not exceeding some maximal speed v, determined by the strength of the jumper. The gravity of g forces him down, thus he moves along the parabolic trajectory. The jumper can choose different starting speeds and different directions for his first and second jump. Of course, The jumper must not attempt to pass through the wall, although it is allowed to touch it passing through the hole, this does not change the trajectory of the jump. The jumper is not allowed to pass through both holes in a single jump. Find out, what must be the maximal starting speed of the jumper so that he could fulfil the excersise. Input Input file contains one or more lines, each of which contains eight real numbers, separated by spaces and/or line feeds. They designate b_{1}, t_{1}, b_{2}, t_{2}, l, d_{s}, d_{f} and g. All numbers are in range from 10^{2} to 10^{3}, t_{1} >= b_{1} + 10^{2}, t_{2} >= b_{2} + 10^{2}. Input file contains at most 1000 test cases. Output For each line of the input file output the smallest possible maximal speed the jumper must have to fulfil the exercise. If it is impossible to fulfil it, output 1. Your answer must be accurate up to 10^{4}. Sample Input
0.3 1.0 0.5 0.9 1.7 1.2 2.3 9.8 Sample Output
5.2883 Author: Andrew Stankevich Source: Andrew Stankevich's Contest #2 