Submit | All submissions | Best solutions | Back to list |
TWOCIRC - OMG and two circles |
OMG is crazy about geometrical shapes. She creates random geometrical figures in her mind and starts to study them. Now, OMG has two non intersecting circles. Also one circle is not inside another. She plots 4 points, 2 in each circle's circumference. Then she connects the 4 points using 3 straight lines with the condition that none of the lines intersect the circles. By this formation, she wonders what the maximum total length of the connected lines will be. Can you help her?
Here is an example for a vaild formation(but not optimal)
Input
First line contains T, the number of test cases.
Next T lines contain 6 integers: r1 x1 y1 r2 x2 y2
r1, r2 are radii of the circles
(x1, y1), (x2, y2) are the centres of the circlles.
Output
For each test case the maximim length possible(accurate to 10e-6)
Constraints
1 <= T <= 1000;
-100000 <= x1, y1, x2, y1 <= 100000
1 <= r1 <= 100000
Example
Input: 3 3 0 -5 3 0 5 3 0 -5 2 0 5 1 -1000 -1000 1 1000 1000 Output: 22.000000 19.949874 2832.427125
No explanations!
Added by: | Noob |
Date: | 2015-11-28 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 MAWK BC NCSHARP COFFEE DART FORTH GOSU JS-MONKEY JULIA KTLN OCT PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA |
Public source code since: | 2015-11-29 19:30:00 |
hide comments
2015-11-29 15:00:55
can i get one more test case |
|
2015-11-28 19:33:55 Noob
Yes, its 22. The problem is corrected now |
|
2015-11-28 18:54:42 Roopesh
Is the answer to the first test case 10 or 10+6+6 (22) ? |
|
2015-11-28 18:29:33
How can none of the lines intersect the circles? If you join the points to get the chord, will it not intersect that circle itself? |