Area of an amazing figure
There is an equilateral triangle ABC with side length 2*a. The coordinates of the triangle's vertices are A = (-a, 0), B = (a, 0) and C = (0, sqrt(3) * a). Next, there are three circles with centers at the midpoints of sides AB, BC and AC respectively and radii r1, r2 and r3 respectively. Compute the area of the intersection of the triangle and the three circles.
- The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
- The first and only line of each test case contains four space-separated integers a, r1, r2, r3.
For each test case, print a single line containing one real number corresponding to the area of the intersection. Your answer will be considered correct if it has an absolute or relative error ≤ 5 * 10-2.
- 1 ≤ T ≤ 20
- 1 ≤ a ≤ 50
- 1 ≤ r1, r2, r3 ≤ 200
Input 5 10 5 5 5 10 6 6 7 10 12 13 14 10 15 15 15 10 19 20 18 Output 0.0000000 1.417303000 138.1789 163.712 173.2064190
Example case 2: The black colored area shown in the figure is the intersection between the triangle and the three circles.
|Tags||acm17chn, admin2, chn17rol, geometry, medium, monte-carlo|
|Time Limit:||5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions