Problem G
Grazed Grains

This year, there have been unusually many UFO sightings reported. Nobody knows if they are caused by optical illusions, weather phenomena, or secret technology being tested by foreign powers (terrestrial or not). UFO enthusiasts across the world rejoice, and speculations run wild. But someone who is not impressed is the farmer Celeste. Her large grain field has repeatedly been used as a landing site by the UFOs, destroying her crops. Celeste would like to bring whoever is responsible to justice, but before she can do so she must assess the damage caused by the unidentified flying offenders.

In total $n$ circular UFOs have landed in Celeste’s field. The $i$th one left a crop circle which destroyed all crops within radius $r_ i$ of the point $x_ i, y_ i$. The field is very large, so you can assume that it extends infinitely in all directions. Your task is to estimate the total area of crops destroyed by the UFOs. Celeste only needs a rough estimate of the true answer, and your answer will be counted as correct if its relative error is less than $10\% $.


The first line of input contains one integer $n$ ($1 \leq n \leq 10$), the number of UFOs. Then follow $n$ lines, the $i$th of which contains the three integers $x_ i$, $y_ i$, and $r_ i$ ($0 \leq x_ i, y_ i \leq 10$, $1 \leq r_ i \leq 10$), describing the crop circle left by the $i$th UFO.


Output the total area covered by the crop circles in the input, with a relative error of at most $1/10$.

Sample Input 1 Sample Output 1
0 0 1
Sample Input 2 Sample Output 2
0 0 2
1 0 1
2 2 2
10 10 1

Please log in to submit a solution to this problem

Log in