Viva ConfettiTime
limit:MS
Memory Limit:0KB
64bit IO Format:%lld & %llu SubmitStatusPracticeuvalive 2572Appoint 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 dis CS 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
30 0 0.5-0.9 0 1.000000000010.9 0 1.0000000000150 1 0.51 1 1.000000000010 2 1.00000000001-1 1 1.000000000010-0.00001 1.00 00000000150 1 0.51 1 1.000000000010 2 1.00000000001-1 1 1.000000000010 0 1.0000000000120 0 1.00000010 0 120 0 10.00000001 0 10
Sample Output
3542
Test instructions: N discs known, placed on top of the desktop in turn. Now according to the order of placement, once given the center position and radius of each disc, ask the last how many discs visible? "Analysis": I haven't thought about it yet. ~~~~~~~ let me think for one night.
Viva Confetti (geometry + disc cover problem)