ZOJ Problem Set - 2600
The company "Gigafon" has recently decided to build cellular network in Flatland. It is well known that the best way to plan the network is to put base stations in the centers of the cells of regular hexagonal grid as shown on the picture.
"Gigafon" has selected the side of the hexagon and the range of each base station. Now the company owners want to know which part of the Flatland will be covered. To estimate this value they ask you to find what part of each hexagon is covered by the network.
You know that business people are very anxious about their money, so they want the answer to be very precise.
Input file contains several test cases. Each case occupies one line with two integers H and R - the side of the hexagon and the range of each base station (1 <= H,R <= 50). A case with H = R = 0 indicates the end of input, which should not be proceeded.
For each test case, output the ratio of the area of hexagon covered by the network to the area of the hexagon itself. Your answer must be accurate up to one hundred digits after the decimal point.
50 47 0 0
Author: Andrew Stankevich
Source: Andrew Stankevich's Contest #6