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

题意:给你一个正三棱锥,正四棱锥和一个正五棱锥,每一个棱锥各自的所有边都相同,问这三个椎体加起来的体积。

思路:这题就是要算正n棱锥的体积,注意如果用long double的话,可以在输入的时候用cin>>a>>b,输出的时候用printf("%.20f\n",(double)ans);

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
#define inf 99999999
#define pi acos(-1.0)
long double cal(long double a,long double n)
{
long double R,alpha,h;
alpha=pi/n;
R=a/(sin(alpha)*2);
h=sqrt(a*a-R*R);
return h*n*a*a/(12*tan(alpha));
} int main()
{
int i,j;
long double l[6];
while(cin>>l[3]>>l[4]>>l[5])
{
long double sum=0;
for(i=3;i<=5;i++){
sum+=cal(l[i],i);
}
printf("%.15f\n",(double)sum);
}
return 0;
}

CodeForces 630Q Pyramids(数学公式)的更多相关文章

  1. codeforces A. Jeff and Rounding (数学公式+贪心)

    题目链接:http://codeforces.com/contest/351/problem/A 算法思路:2n个整数,一半向上取整,一半向下.我们设2n个整数的小数部分和为sum. ans = |A ...

  2. Codeforces Round #259 (Div. 1) A. Little Pony and Expected Maximum 数学公式结论找规律水题

    A. Little Pony and Expected Maximum Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.c ...

  3. codeforces 650 C. Watchmen(数学公式)

    C. Watchmen time limit per test 3 seconds memory limit per test 256 megabytes input standard input o ...

  4. Codeforces Round #643 (Div. 2) C. Count Triangles (数学公式)

    题意:给你四个正整数\(A,B,C,D\),且\(A\le B\le C \le D\),有\(A\le x\le B\le y\le C \le z\le D\),求最多有多少组\((x,y,z)\ ...

  5. Codeforces Round #376 (Div. 2) D. 80-th Level Archeology —— 差分法 + 线段扫描法

    题目链接:http://codeforces.com/contest/731/problem/D D. 80-th Level Archeology time limit per test 2 sec ...

  6. Educational Codeforces Round 65 (Rated for Div. 2)题解

    Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...

  7. LATEX数学公式基本语法

    TEX 是Donald E. Knuth 编写的一个以排版文章及数学公式为目标的计算机程序.TEX的版本号不断趋近于π,现在为3.141592.由Pascal 语言写成,特点: 免费.输出质量高.擅长 ...

  8. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  9. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

随机推荐

  1. spring boot gateway 过滤器的执行顺序

    前言 学习官方文档,发现对于过滤器有分为三类 默认过滤器 自定义过滤 全局过滤器 于是就有一个疑问,关于这些过滤器的访问顺序是怎样的,今天就以一个demo来进行测试 准备阶段 过滤器工厂类 以此为模板 ...

  2. 有了链路日志增强,排查Bug小意思啦!

    在工作中,相信大家最怕的一件事就是听到有人在工作群艾特你:某某功能报错啦... 然后你就得屁颠屁颠的去服务器看日志,日志量少还好点,多的话找起来太麻烦了.不太容易直接定位到关键地方. 东找找西找找,好 ...

  3. Subline Text 3 安装

    Subline Text 3 下载 下载链接 http://www.sublimetext.com/3 ,下载Subline Text3的安装包,这里以 64位的windows10为例,如果是其他操作 ...

  4. explain select * from xuehao;

    mysql> explain select * from xuehao;+----+-------------+--------+------+---------------+------+-- ...

  5. mysql .sock丢时候如何链接数据库

    在mysql服务器本机上链接mysql数据库时,经常会噢出现mysql.sock不存在,导致无法链接的问题,这是因为如果指定localhost作为一个主机名,则mysqladmin默认使用unix套接 ...

  6. 2021升级版微服务教程7-OpenFeign实战开发和参数调优

    2021升级版SpringCloud教程从入门到实战精通「H版&alibaba&链路追踪&日志&事务&锁」 教程全目录「含视频」:https://gitee.c ...

  7. linux系统中set、env、export关系

    set 用来显示shell变量(包括环境变量.用户变量和函数名及其定义),同时可以设置shell选项来开启调试.变量扩展.路径扩展等开关env 用来显示和设置环境变量export 用来显示和设置导出到 ...

  8. window安装nvm

    先说一下背景,最近做的两个项目一个是祖传angularjs1.X版本另一个是react hooks结合tailwindcss,前者angularjs的node版本比较低,而tailwindcss的no ...

  9. [Usaco2009 Feb]Bullcow 牡牛和牝牛

    原题链接https://www.lydsy.com/JudgeOnline/problem.php?id=3398 容易想到的一种\(dp\)就是:设\(dp[i][j]\)表示前\(i\)头牛里面有 ...

  10. 18V转5V,18V转3.3V,18V转3V稳压芯片,0.01A-3A输出

    18V转5V,18V转3.3V,18V转3V, 18V转5V稳压芯片,18V转3.3V稳压芯片,18V转3V稳压芯片, 18V常降压转成5V电压,3.3V电压和3V电压给其他芯片或设备供电,适用于这个 ...