问题 1845 --Mindis1845: Mindis
时间限制: 6 Sec 内存限制: 128 MB
提交: 8 解决: 0
[提交][状态][讨论版][命题人:]题目描述
The center coordinate of the circle C is O, the coordinate of O is (0,0) , and the radius is r.
P and Q are two points not outside the circle, and PO = QO.
You need to find a point D on the circle, which makes PD+QD minimum.
Output minimum distance sum.
输入描述
The first line of the input gives the number of test cases T; T test cases follow.
Each case begins with one line with r : the radius of the circle C.
Next two line each line contains two integers x , y denotes the coordinate of P and Q.
Limits
T≤500000
−100≤x,y≤100
1≤r≤100
输出描述
For each case output one line denotes the answer.
The answer will be checked correct if its absolute or relative error doesn't exceed 10−6.
Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if |a−b|max(1,b)≤10−6.
样例输入
4
4
4 0
0 4
4
0 3
3 0
4
0 2
2 0
4
0 1
1 0
样例输出
5.6568543
5.6568543
5.8945030
6.7359174
来源
[提交][状态]