Arthur's Table
Time limit1sMemory limit512 MB
Given a round table's diameter, the number of knights, and the offset of the central platter, find the platter's radius and the first four trenchers' centers and radii.
- Level
Hard8 of 10
- Topics
- Geometry, Binary search, Math, Implementation
- Solved
- No attempts yet
Problem
King Arthur is known for believing that all knights are equal, and for his round table.
At the center is a serving platter (did Merlin invent the lazy Susan?).
Each knight has a circular trencher to eat from:

Unfortunately, Merlin accidentally called up a pre-shadow of George Orwell, and Arthur began muttering something like:
... but some knights are more equal than others ...
So Arthur asked Merlin to move the central serving platter a little away from him, so that he and his closest aides could have a little more room:

Merlin complained that every trencher and the central serving platter would have to be remade. Arthur, like a good leader, said, 'Deal with it.'
Write a program to help Merlin make the new trenchers and central serving platter. We describe the layout in a coordinate system with its origin at the center of the table, the axis pointing to Arthur's seat, and the axis perpendicular to the axis:

Input
Input consists of a single line containing the diameter of the table in kingly feet (8 \le D \le 30), the number of knights to be seated (7 \le N \le 40), and the offset from the center of the table to the center of the central serving platter (0.1 \le O <$ the radius of an original trencher), given as a decimal number of kingly feet.
Output
The output consists of five lines. The first line gives the radius of the central serving platter in kingly feet, to 3 decimal places, with center at . Here the offset is the input .
The next four lines each contain three space-separated floating-point values to 3 decimal places. These values are the coordinate of a trencher's center, the coordinate of the trencher's center, and the trencher's radius, all in kingly feet. The four lines give Arthur's trencher and the next three trenchers counter-clockwise from Arthur's, one set of values per line.