Drawing a Character Face
Time limit0.1sMemory limit256 MB
Given three circles, compute the area of their union, counting overlaps once, and print it to six decimal places.
- Level
Hard8 of 10
- Topics
- Geometry, Math, Implementation, Brute force
- Solved
- No attempts yet
Problem
Many character faces can be drawn with three circles. When the face is one circle and the two ears sticking out at the sides are circles as well, laying three circles on top of each other already gives the rough outline of the face. The mouse character, the lion character, the tiger character and the bear character all work this way.

You want the area of the figure drawn this way. Given the center and the radius of each of the three circles, write a program that computes the area of the region the three circles cover. Area where two circles overlap counts once.
Input
The input has three lines. Each line holds the integers , and , separated by spaces. They are the coordinate of the center, the coordinate of the center and the radius of the circle, in that order.
Every circle lies inside the square whose opposite corners are and , so and . The radius is at least .
Two of the three circles can sit at the same place with the same radius, and one circle can lie completely inside another.
Output
Print the area of the region the three circles cover on one line, rounded to six digits after the decimal point. Always print all six digits.