UVa 10301 - Rings and Glue

10301 - Rings and Glue

 * http://acm.uva.es/p/v103/10301.html

Summary
This is a basic geometry problem about circles.

Explanation
Two rings are glued together when the distance between two center is greater than sum of radius ( dist >= r1+r2 ) and less than diff of radius ( dist <= fabs(r1-r2) ) A special case is two ring is totally overlap. (r1==r2 && center1==cneter2)

Gotchas
You must print "0 rings." when number of max component is 0.

Input
4 0.0 0.0 1.0 -1.5 -1.5 0.5 1.5 1.5 0.5 -2.0 2.0 3.5 3 3.0 2.0 2.0 0.0 -0.5 1.0 0.0 0.0 2.0 5 -2.0 0.0 1.0 1.0 -1.0 1.0 0.0 1.0 0.5 2.0 0.0 1.0 -1.0 1.0 1.0 -1

Output
The largest component contains 4 rings. The largest component contains 2 rings. The largest component contains 3 rings.