0205. Circles

Имя входного файла: circles.in
Имя выходного файла: circles.out
Ограничение по времени: 2 s
Ограничение по памяти: 64 megabytes

Consider N different circles on the plane. They divide it to several parts, you have to find the number of these parts.

For the purpose of this problem the circle of radius r with center (x0, y0) is the set of points C={(x, y) | (x - x0)2+(y - y0)2 = r2 }.

Input file

The first line of the input file contains N – the number of circles (1 ≤ N ≤ 50). Next N lines contain three integer numbers x0, y0, and r each – the coordinates of the center and the radius of the circle.

All coordinates do not exceed 103 by their absolute value, all radii are positive and do not exceed 103.

No two circles coincide.

Output file

First output K – the number of parts circles divide the plane to.

Due to floating point precision losses possible, do not consider parts with area not exceeding 10-10.

Examples:

circles.incircles.out
2 0 0 3 0 0 2 3


Источник: Petrozavodsk Winter 2004. Andrew Stankevich Contest 4, Friday, January 30
Автор: Andrew Stankevich

Обсудить       Отправить решение



Версия для печати