Dolphin Pool
Time limit1sMemory limit128 MB
Given up to 20 circles with disjoint centers, count the bounded regions outside all circles that the circles enclose.
Problem
In a newly built dolphin pool on Kish Island in the Persian Gulf, one of the fun games is the following. The host throws several plastic rings (circles) onto the water so that no ring's center lies inside any other ring, and no two rings are tangent to each other. On the host's whistle, the dolphins are trained to jump out through the closed areas that lie completely outside every ring, one dolphin per such area. The dolphins jump out if and only if the number of such closed areas is exactly equal to the number of dolphins.
Here, a closed area is a bounded region of the plane that lies outside all of the rings and is enclosed by them. Given the position and radius of every ring, write a program that computes the number of closed areas formed between the rings.
Input
The first line contains the number of test cases (at most 20). The first line of each test case contains an integer (), the number of plastic rings. Each of the following lines contains three integers: the first two are the and coordinates of the center of the ring's circle, and the third is its radius. Coordinates are positive integers less than 1000, and each radius is in the range 1 to 100.
Output
For each test case, print a single line containing the number of closed areas in that test case.