#P5931. [清华集训 2015] 灯泡

[清华集训 2015] 灯泡

Description

Compared with Wildleopard’s home, his younger brother Mildleopard is poorer. His house is narrow, and there is only one light bulb in his room. Every night, he walks around in his small house, thinking about how to earn more money. One day, he found that the length of his shadow changes as he walks between the light bulb and the wall. A sudden idea came to his mind: he wants to know the maximum possible length of his shadow in the room.

Input Format

The first line contains an integer TT, the number of test cases.

For each test case, there is one line containing three real numbers HH, hh, and DD. HH is the height of the light bulb, hh is Mildleopard’s height, and DD is the horizontal distance between the light bulb and the wall.

Output Format

Output TT lines. For each test case, output one line with the maximum shadow length LL. Your answer is accepted if the absolute error compared with the standard output is at most 10310^{-3}.

3
2 1 0.5
2 0.5 3
4 3 4
1.000
0.750
4.000

Hint

Constraints: 1T1001 \le T \le 100, 0.01H,h,D10000.01 \le H, h, D \le 1000, Hh0.01H - h \ge 0.01. It is guaranteed that HH, hh, and DD have at most 66 digits after the decimal point.

Translated by ChatGPT 5