CodeForces 630Q:Pyramids【几何】
2016-03-13 21:20
519 查看
Pyramids
Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
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.
Sample Input
Input
Output
题意:给你正三棱锥,正四棱锥,正五棱锥的边长,让你求它们的体积和是多少。
思路:卡就卡在高上。。。。百度到的
正四面体 高
底面积
体积
正五面体 高
底面积
体积
正六面体 高
底面积
其中
体积
AC-code:
Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
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.
Sample Input
Input
2 5 3
Output
38.546168065709
题意:给你正三棱锥,正四棱锥,正五棱锥的边长,让你求它们的体积和是多少。
思路:卡就卡在高上。。。。百度到的
正四面体 高
底面积
体积
正五面体 高
底面积
体积
正六面体 高
底面积
其中
体积
AC-code:
#include<cstdio> #include<cmath> #define PI acos(-1.0) int main() { double a,b,c,s1,s2,s3,k,h1,h2,h3,v1,v2,v3; scanf("%lf%lf%lf",&a,&b,&c); h1=sqrt(6)*a/3; s1=sqrt(3)*a*a/4; v1=h1*s1/3; h2=b/sqrt(2) ; s2=b*b; v2=h2*s2/3; k=1/(2*tan(PI/10)*(1+cos(PI/5))); h3=sqrt(1-k*k)*c; s3=5*k*cos(PI/5)*c*c/2; v3=h3*s3/3; printf("%.10lf\n",v1+v2+v3); return 0; }
相关文章推荐
- 分别写出BOOL,int,float,指针类型的 变量a与零相比的语句
- 【机房重构】视图
- 自定义主题
- android studio 开发环境搭建及常见问题解决方法
- 区域生长算法原理及MATLAB实现
- 还是决定在这里留下自己的足迹
- iOS开发UI篇—核心动画(关键帧动画)
- 使用病毒库检查手机中已经安装的程序
- JMS实例
- <!DOCTYPE>标签的定义与用法
- 算法训练 最大的算式
- Connect中间件示例
- 测试思考
- 判断是否为平衡二叉树--递归法
- 这段代码在32位计算机上的执行结果是什么?
- HTTP请求和数据安全
- HDU 2187
- 关系模型之关系代数
- mapreduce的shuffle阶段详解
- HDU 1423 —— Greatest Common Increasing Subsequence