Description Problem E Gifts in a HexagonalBox Input: Output: Time Limit: Memory Limit: When we buy giftsfor someone, we also try to make sure that the box in which thegifts are placed is also beautiful. So the gift box is a veryimportant thing. I don�t want to discuss more on this issue, so nowlet�s move our attention to the image below. This image shows howround gifts can be put optimally in a regular hexagon shaped box (Aregular hexagon is a hexagon whose all edges are equal and allinternal angles are also equal). Given the lengthof one side of the hexagonal box, you will have to find the radiusof the circular gifts for all four cases. You can assume that theplacement of the gifts is symmetric as they are shown in the figureabove. To be more precise a) b) c) d) e) InputThe input file contains several lines of input.Each line contains a single non negative floating pointnumber OutputFor eachline of input produce one line of output. This line should containfour floating point numbers Sample Input0.0000001 0.0000002 0.0000003 Sample Output0.00000008660.0000000464 0.0000000433 0.0000000375 0.00000017320.0000000928 0.0000000866 0.0000000750 0.00000025980.0000001392 0.0000001299 0.0000001125 (Math Lovers� Contest, Problem Setter:Shahriar Manzoor, |
关键是公式的推导:
#include<stdio.h> #include<math.h> int main() { long double n,r1,r2,r3,r4; while(scanf("%llf",&n)!=EOF) { r1=n*sqrt(3.0)/2; r2=n/(2/sqrt(3.0)+1); r3=r1/2; r4=(-7*sqrt(3.0)*n+n*sqrt(252.0))/10; printf("%.10llf %.10llf %.10llf %.10llf\n",r1,r2,r3,r4); } return 0; }