UKNIRP - Sight Logic
Flynn Ryder is a lazy fellow studying in a reputed college which teaches him Computer Science. He has a crush over a girl in the class next to his class. Every time when she crosses his class, he never misses to get a glimpse of her through the window in his class. He always sits near the window so that he can never miss the opportunity to see her. Suddenly, he thought of calculating the ideal place where he can be seated so that he can watch her exactly until the end of the balcony, where she crosses in his view area, if possible. He has constraints over the distance up to which he can see.
- Maximum angle he can turn his head is 60 degrees, beyond that, the teacher might catch him.
- The balcony outside his classroom has a "L" shaped configuration as shown.
- The window in his classroom has a length of 2 meters and he can sit anywhere in that 2 meters gap near the window.
- He can watch her through the window, after she crosses him in the segment of the balcony where the window is present.
- He can't see her, while she's walking parallel to his class, where there is no window.
- Assume he can watch her right from the intersection of the balconies, while she is walking perpendicular to his class.
You, being Flynn Ryder's Best Friend, help him to create a program which does the work for Flynn Ryder.
Input
First get the number of test cases "t" which are to be processed. For each test case, you are given three values L, H, W.
- L - Length of the balcony where Flynn Ryder's class is present.
- H - Length of the other arm of the balcony.
- W - Distance from the intersection point of the balconies to the starting point of the window through which Flynn Ryder is going to see his crush. Window can be anywhere on the side "L" with length of 2 meters.
Constraints
0 < t < 1000
0 < L, H < 10^19
Output
The output should contain two values for each test case. First one is the ideal distance where Flynn Ryder should be seated to have the glimpse of her right until the end of the balcony, if he can. Second one is the distance, in which Flynn Ryder can see her crossing the balcony, sitting from the ideal position. Outputs must be accurate to 2 decimal places. Print each pair of values on a new line.
Example
Input: 2 5 6 3 5 5 3 Output: 3.46 6.46 3.00 5.00
Added by: | Shenbaga Prasanna |
Date: | 2013-03-16 |
Time limit: | 1s |
Source limit: | 1000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C C++ 4.3.2 CPP C99 JAVA PHP |
Resource: | Own Problem. Any resemblance with real life scenarios are purely coincidential. |