Swim, Run, Solve


Submit solution


Points: 1
Time limit: 3.0s
Memory limit: 512M

Author:
Problem types

Max is, as he is wont to do, taking part in a very strange programming competition. The competition is being held at the local beach. The contestants start at designated positions in the water some distance from the shore, and their computers are set up some distance inland from the shore. Max is confident in his ability to solve the problems once he gets to his computer, but is worried that he will lose time getting to his designated computer. Conveniently, Max knows his swimming and running speeds exactly, and is an uncanny judge of distance. For the purposes of this problem you can consider the shore to be a single, straight, instantaneous transition between water and sand.

Can you help Max by finding the minimum amount of time it will take him to reach his computer?

Input Specification

The first line contains an integer \(1 \leq T \leq 100\), the number of test cases to follow. The next \(T\) lines each contain a single test case, specified by the space-separated integers \(x, y_w, y_s, v_w, v_s\) where \(0 \leq x \leq 10^6\) is the the parallel distance along the shore between Max and his computer, \(1 \leq y_w, y_s \leq 10^6\) are the perpendicular distances from the shore to Max and to his computer, respectively, and \(1 \leq v_w, v_s \leq 10^6\) are Max's swimming and running speeds, respectively. All distances are given in metres and speeds in metres per second.

Output Specification

For each each test case, output a single line containing the fastest time (in seconds) in which Max can get from his starting point to his computer, accurate to an absolute or relative error of \(10^{-7}\).

Note: Floating point precision can be an issue with this question. Consider using long double, or BigDecimal, and carefully choosing how you use an epsilon.

Sample Input

2
100 50 50 5 5
100 80 20 1 10

Sample Output

28.284271
89.813758

Comments

There are no comments at the moment.