79 - The 6th Zhejiang Provincial Collegiate Programming Contest - G
The government is making strenuous efforts to reforest the hill. To trace the growing status of the trees, an observer is placed in the middle of the area at the coordinate (0, 0). To simplify our model, let us assume that:
What we are interested in here is that when the observer will lose sight on the skyline. Or we put it in the words that the observer could not see anything outside the forest in any horizontal directions.
The first line of the input contains an integer T, T < 150, which is the number of test cases.
For each test case, output the time that the observer would lose the sight of the sky. The answer be accurate up to six decimal places. If the observer will never be blocked by the trees, you should output "-1.0" instead.
2 2 0 1 0 -2 3 1 0 0 1 0 -1
Author: GAO, Fei
Source: The 6th Zhejiang Provincial Collegiate Programming Contest