D - Gifts in a Hexagonal Box

Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld &%llu

[Submit [GoBack  [Status]

Description

Problem E

Gifts in a HexagonalBox

Input: standardinput

Output: standardoutput

Time Limit: 2seconds

Memory Limit: 32MB

 

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).

 

Gifts <wbr>in <wbr>a <wbr>Hexagonal <wbr>Box <wbr> <wbr> <wbr> <wbr>求圆半径

 

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)      Inthe first case the gift touches all six sides of the box.

b)      Inthe second case both the gifts touch two sides of the box.

c)      Inthe third case all the gifts touch two different sides of thebox.

d)      Inthe fourth case two gifts touch two different sides of the box andother two touches one side.

e)      Theradiuses of all circular gifts are equal for every single case.

Gifts <wbr>in <wbr>a <wbr>Hexagonal <wbr>Box <wbr> <wbr> <wbr> <wbr>求圆半径

Input

The input file contains several lines of input.Each line contains a single non negative floating pointnumber S (S<=10000), here S isthe length of one side of the hexagonal box.

 

Output

For eachline of input produce one line of output. This line should containfour floating point numbers r1, r2, r3,r4 separated by a single space.Here r1 is the radius ofthe gift when only one gift is kept inside thebox; r2 is the radius ofthe gifts when only two gifts are placed inside thebox. r3 and r4 hassimilar meanings. The floating point numbers should have ten digitsafter the decimal point. Outputs will be checked with specialjudge, so small precision errors will be ignored.

 

Sample Input

0.0000001

0.0000002

0.0000003

 

Sample Output

0.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, Thanks to Dr. ErichFriedman)

[Submit [GoBack  [Status]

关键是公式的推导:


#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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值