Codeforces 630Q Pyramids

Q. Pyramids
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output

IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of course the amount of the city budget funds for the construction depends on the pyramids' volume. Your task is to calculate the volume of the pilot project consisting of three pyramids — one triangular, one quadrangular and one pentagonal.

The first pyramid has equilateral triangle as its base, and all 6 edges of the pyramid have equal length. The second pyramid has a square as its base and all 8 edges of the pyramid have equal length. The third pyramid has a regular pentagon as its base and all 10 edges of the pyramid have equal length.

Input

The only line of the input contains three integers l3, l4, l5 (1 ≤ l3, l4, l5 ≤ 1000) — the edge lengths of triangular, quadrangular and pentagonal pyramids correspondingly.

Output

Output one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.

Examples
input
2 5 3
output
38.546168065709

求正三棱锥,正四棱锥,正五棱锥体积之和   分别计算出公式,然后带入

#include <iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define Pi acos(-1.0)
using namespace std;

int main()
{
    double l3,l4,l5,v;
    while(~scanf("%lf%lf%lf",&l3,&l4,&l5))
    {
        v=0;
        v+=sqrt(2)/4*l3*l3*l3/3;
        v+=sqrt(2)/2*l4*l4*l4/3;
        //printf("%.10lf\n",v);
        double x=(l5/2)/sin(36.0/360*2*Pi);
        double y=(l5/2*sin(54.0/360*2*Pi))/sin(36.0/360*2*Pi);
        //printf("%lf %lf\n",x,y);
        v+=5*l5*y/2*sqrt(l5*l5-x*x)/3;
        printf("%.10lf\n",v);
    }
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值