BRLRIDER - Barrelrider

Description

Bilbo the Barrelrider is attempting to elude Smaug the Terrible in the treasure-filled halls of Erebor.
He uses the obstacles (piles of gold, columns, etc.) in the room to hide from Smaug's view. These obstacles can be approximated by circles.
Smaug may approach Bilbo from any direction. Bilbo's concealment is the proportion of directions for which an obstacle would be between himself and the dragon.
In total, how much concealment do the obstacles offer Bilbo?
In the example below to the left, the obstacle affords him 90 degrees (25%) concealment.
In the middle example, Bilbo is right next to the obstacle, and it offers 180 degrees (50%) concealment.
If Bilbo is inside an obstacle (say, inside a pile of gold), he cannot be seen at all.
> > B > > B > > B
Obstacles can overlap.
In the example below to the left, Bilbo has 100% concealment.
In the right example, he has 90 + 53.1 = 143.1 degrees (40%) concealment.
> > B > > B

Input

The first line is 0 <= N <= 1000, the number of obstacles.
The next N lines are the obstacles, each represented by 3 space-separated integers. The first two integers are -5000 <= X <= 5000 and -5000 <= Y <= 5000, which are the x- and y-coordinates, respectively, of the center of the obstacle. (Bilbo is standing at (0,0).) The third integer is its radius 0 < R <= 1000.

Output

Print the percentage of concealment the obstacles offer Bilbo, rounded to the nearest whole percent.
Input Input Input Input Input
1
2 2 2
1
2 0 2
1
1 0 2
8
0 -1 1
-1 0 1
-2 1 1
-1 2 1
0 -1 1
1 -2 1
2 -1 1
1 0 1
4
-3 2 1
-2 2 2
2 -1 1
3 -1 1
Output Output Output Output Output
25%
50%
100%
100%
40%

Added by:BYU Admin
Date:2014-02-23
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2022-04-07 20:14:26 Simes
The fourth test input doesn't correspond to the fourth example image, but the result is still 100%

And here's a test case my AC solution got wrong:
1
0 5 2


Last edit: 2022-04-08 06:53:46
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.