Rains
Time limit2sMemory limit512 MB
Given a grid of regular N-gons with side S and a brain of radius R, find the probability a random brain center lands close enough to a thread to be cut.
- Level
Medium6 of 10
- Topics
- Geometry, Probability, Math, Implementation
- Solved
- No attempts yet
Problem
It is the end of the world. The fish community rises up against years of humanity's abuse and declares war on mankind.
After millions of years of unemployment and reliance on robots, humans became spheres of radius consisting of only one part, the brain. Fish rebels developed a special weapon named the rains of Atlantic, which consists of large heavy sieves prepared to slice humans. A sieve is made of extremely thin stretched strings in the form of a grid of convex regular -sided polygons of side length . The figure below shows examples for , , and :

You are the last survivor, but they have finally identified the city where you hide. They are going to throw a sieve that will cover the whole city. Your brain will be sliced if one of the threads from the sieve touches it. What is the probability that your brain will be sliced if you can be located anywhere in the city with equal probability?
Input
Your program will be tested on one or more test cases. The first line of the input contains a single integer (), the number of test cases.
Each test case consists of one line containing three integers:
- : the number of sides of the polygon in the sieve ()
- : the side length of the polygon in the sieve ()
- : the radius of your brain ()
Output
For each test case, print a single line containing the probability that your brain will be sliced, rounded to four decimal places.
Hint
A regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length).