Viva Confetti (geometry + disc cover problem)

Source: Internet
Author: User

Viva Confetti Time limit:3000MS Memory Limit:0KB 64bit IO Format:%lld &%llu Submit Status Practice uvalive 2572 appoint Description:system Crawler (2015-04-19)

Description

Do you know confetti? They is small discs of colored paper, and people throw them around during parties or festivals. Since people throw lots of confetti, they may end-up stacked one on another, so there could be hidden ones underneath.

A handful of various sized confetti has been dropped on a table. Given their positions and sizes, can you tell us how many of them can I see?

The following figure represents the disc configuration for the first sample input, where the bottom disc is still visible.

Input

The input is composed of a number of configurations of the following form.


N
X1 Y1 R1
X2 Y2 R2
Xn Yn Rn


The first line with a configuration is the number of discs in the configuration (a positive integer not more than), Foll Owed by one Ine descriptions of each disc:coordinates of it center and radius, expressed as real numbers in decimal nota tion, with up to digits after the decimal point. The imprecision margin is 5 x 10-13. That's, it is guaranteed this variations of less than 5 x 10-13 on input values does not change which discs is visible. Coordinates of all points contained in discs is between-10 and 10.

Confetti is listed in their stacking order, x1y1r1 being the bottom one and xnynrn the top one. You is observing from the top.

The end of the input is marked by a zero in a single line.

Output

For each configuration, you should output the number of visible confetti on a.

Sample Input

3
0 0 0.5
-0.9 0 1.00000000001
0.9 0 1.00000000001
5
0 1 0.5
1 1 1.00000000001
0 2 1.000000000
1 1 1.00000000001
0-0.00001 1.00000000001
5
0 1 0.5
1 1 1.00000000001
0 2 1.00000000001< C13/>-1 1 1.00000000001
0 0 1.00000000001
2
0 0 1.0000001
0 0 1
2
0 0 1
0.00000001 0 1< C21/>0

Sample Output

3
5
4
2



Test instructions: N discs known, placed on top of the desktop in turn. Now according to the order of placement, the center position and radius of each disc are given at once, asking how many discs are visible at the end. "Analysis": I haven't thought about it yet. ~~~~~~~ let me think for one night.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.