spoj#BRLRIDER. Barrelrider

Barrelrider

.center { margin-right: auto; margin-left: auto; } .example-table { margin-top: 10px; text-align: left; width: 100%; } .example-table td { max-width: 0; word-wrap: break-word; vertical-align: top; } .example-table .vertical-spacer { height: 5px; } .section { margin-top: 19px; margin-bottom:19px; } .section:first-child, .section:first-child > h3:first-child { margin-top: 0; } .paragraph { margin-top: 10px; margin-bottom: 10px; text-align: left; } .paragraph ul, .paragraph pre { margin-top: 3px; margin-bottom: 3px; } pre { tab-size: 4; } .billboard { line-height: 1em; outline: solid 1px black; } svg.example { width: 195px; height: 195px; display: inline-block; } .bilbo circle { stroke: black; stroke-width: 1; fill: white; } .bilbo text { font-family: sans-serif; font-size: .5px; font-weight: bold; text-anchor: middle; } .obstacle { stroke: black; stroke-width: 1; fill: none; shape-rendering: geometricPrecision; } .ray { stroke: blue; stroke-width: 1; } .grid line { stroke: #ccc; stoke-width: 1; }

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
<div class="section">
	<h3>Input</h3>
	<div class="paragraph">
		The first line is 0 &lt;= N &lt;= 1000, the number of obstacles.
		<br>
		The next N lines are the obstacles, each represented by 3 space-separated integers. The first two integers are -5000 &lt;= X &lt;= 5000 and -5000 &lt;= Y &lt;= 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 &lt; R &lt;= 1000.
	</div>
</div>

<div class="section">
	<h3>Output</h3>
	<div class="paragraph">
		Print the percentage of concealment the obstacles offer Bilbo, rounded to the nearest whole percent.
	</div>
</div>

<table class="section example-table">
	<tbody><tr>
		<th>Input</th>
		<th>Input</th>
		<th>Input</th>
		<th>Input</th>
		<th>Input</th>
	</tr>
	<tr>
		<td>
1
2 2 2
		</td>
		<td>
1
2 0 2
		</td>
		<td>
1
1 0 2
		</td>
		<td>
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
		</td>
		<td>
4
-3 2 1
-2 2 2
2 -1 1
3 -1 1
		</td>
	</tr>
	<tr>
		<th>Output</th>
		<th>Output</th>
		<th>Output</th>
		<th>Output</th>
		<th>Output</th>
	</tr>
	<tr>
		<td>
25%
		</td>
		<td>
50%
		</td>
		<td>
100%
		</td>
		<td>
100%
		</td>
		<td>
40%
		</td>
	</tr>
</tbody></table>