Problem Statement | |||||||||||||
There are some circles on the plane. Circles may lie completely inside other circles, but may not touch or intersect other circles in any other way. Initially, the plane is entirely black. Then circles are drawn in order of non-increasing radii. If a circle is drawn on a black background, it is filled with the color white. If it is drawn on a white background, it is filled black. Your task is to compute the total white area on the plane after drawing all the circles.
You are given a String[] circles containing the circles on the plane. Each element will be formatted as "X Y R", where (X, Y) are the coordinates of the center of the circle, and R is the radius. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | A circle can lie completely inside another circle only if it has a smaller radius than the outer circle. | ||||||||||||
- | The returned value must be accurate to 1e-9 relative or absolute. | ||||||||||||
Constraints | |||||||||||||
- | circles will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of circles will be formatted as "X Y R", where X, Y, and R are integers with no leading zeroes. | ||||||||||||
- | Each X and Y will be between 0 and 10000, inclusive. | ||||||||||||
- | Each R will be between 1 and 100, inclusive. | ||||||||||||
- | No two circles in circles will touch or intersect (unless one lies completely inside the other). | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|