Problem E
Gifts in a Hexagonal Box
Input: standard input
Output: standard output
Time Limit: 2 seconds
Memory Limit: 32 MB
When we buy gifts for someone, we also try to make sure that the box in which the gifts are placed is also beautiful. So the gift box is a very important thing. I don’t want to discuss more on this issue, so now let’s move our attention to the image below. This image shows how round gifts can be put optimally in a regular hexagon shaped box (A regular hexagon is a hexagon whose all edges are equal and all internal angles are also equal).
Given the length of one side of the hexagonal box, you will have to find the radius of the circular gifts for all four cases. You can assume that the placement of the gifts is symmetric as they are shown in the figure above. To be more precise
a) In the first case the gift touches all six sides of the box.
b) In the second case both the gifts touch two sides of the box.
c) In the third case all the gifts touch two different sides of the box.
d) In the fourth case two gifts touch two different sides of the box and other two touches one side.
e) The radiuses of all circular gifts are equal for every single case.
The
input file contains several lines of input. Each line contains a single non
negative floating point number S (S<=10000), here S is the length of one side of the
hexagonal box.
For each line of input produce one line of output. This line should
contain four floating point numbers r1,
r2, r3, r4 separated by a single space. Here r1 is the radius of the gift when only one gift is kept inside the
box; r2 is the radius of the gifts
when only two gifts are placed inside the box. r3 and r4 has similar
meanings. The floating point numbers should have ten digits after the decimal
point. Outputs will be checked with special judge, so small precision errors
will be ignored.
0.0000001
0.0000002
0.0000003
0.0000000866 0.0000000464 0.0000000433 0.0000000375
0.0000001732 0.0000000928 0.0000000866 0.0000000750
0.0000002598 0.0000001392 0.0000001299 0.0000001125
(Math Lovers’
Contest, Problem Setter: Shahriar Manzoor, Thanks to Dr. Erich Friedman)