Three Circles
Very hard
Execution time limit is 3 seconds
Runtime memory usage limit is 256 megabytes
Given up to N ≤ 3 circles on a plane, your task is to calculate the area of their union.
This problem is straightforward, so please avoid overly complex solutions.
Input
The first line contains the integer N (1 ≤ N ≤ 3).
Each of the next N lines contains 3 integers, representing the coordinates of the center and the radius of each circle.
All circles are entirely contained within the square defined by 0×0 to 100×100.
The radius of each circle is positive.
Output
Output a single real number representing the area of the union of the circles.
The result should have a relative error no greater than 10^{-6}.
Examples
Input #1
Answer #1
Submissions 35