CodeForces 630Q Pyramids(数学公式)
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.
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 one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.
2 5 3
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(数学公式)的更多相关文章
- codeforces A. Jeff and Rounding (数学公式+贪心)
题目链接:http://codeforces.com/contest/351/problem/A 算法思路:2n个整数,一半向上取整,一半向下.我们设2n个整数的小数部分和为sum. ans = |A ...
- 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 ...
- codeforces 650 C. Watchmen(数学公式)
C. Watchmen time limit per test 3 seconds memory limit per test 256 megabytes input standard input o ...
- 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)\ ...
- 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 ...
- Educational Codeforces Round 65 (Rated for Div. 2)题解
Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...
- LATEX数学公式基本语法
TEX 是Donald E. Knuth 编写的一个以排版文章及数学公式为目标的计算机程序.TEX的版本号不断趋近于π,现在为3.141592.由Pascal 语言写成,特点: 免费.输出质量高.擅长 ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
随机推荐
- 基于腾讯云存储网关 CSG 实现视频在线转码分发
一.背景 随着越来越多的传统业务云化和云端业务发展,数据上云和云端数据处理领域的需求爆发式增长.腾讯云存储网关CSG提供一键部署开箱即用的便捷模式,深度结合COS对象存储生态,为用户提供方便快捷的数据 ...
- 按装parallels tool的失败之路
这是一篇对于其他人来说没什么意义的博客.单纯的可以被看作是日记. 首先,我想安装parallels tool. 但是照着网上很多教程(如www.cnblogs.com/artwalker/p/1323 ...
- ALV中layout布局控制详解
参数的结构为SLIS_LAYOUT_ALV.结构中比较常用的字段如下: no_colhead 隐藏列标题 值为X或空 no_hotspot headings不作为热 ...
- Docker数据目录迁移解决方案
场景 在docker的使用中随着下载镜像越来越多,构建镜像.运行容器越来越多, 数据目录必然会逐渐增大:当所有docker镜像.容器对磁盘的使用达到上限时,就需要对数据目录进行迁移. 如何避免: 1. ...
- IE浏览器的卸载操作
1.首先进入打开这个 C:\Windows\TEMP\ 文件夹,将里面的所有文件都清空了. 2.依次点击"开始"-"所有程序"-"附件",右 ...
- Linux内存 free 详解
在Linux下,使用top命令看到内存占用情况: Mem: 4146788k total, 3825536k used, 321252k free, 213488k buffers Swap: ...
- Centos虚拟机上安装部署Tenginx,以及部署过程中遇到的问题
Tenginx下载网址: Tenginx 官网地址:http://tengine.taobao.org/ Tenginx的官方网址中可以阅读Nginx的文档,可以选择中文进行阅读.下载Tengine- ...
- BFS DFS与回溯
https://blog.csdn.net/u014303647/article/details/88328526 cyc: https://github.com/CyC2018/CS-Notes/b ...
- idea一定要做的配置
自动编译开关 忽略大小写开关 IDEA默认匹配大小写,如果你开了这个开关,你无论输入String或者string都会出现代码提示或者智能补充 智能导包开关 两个选项勾上:自动导入不明确的结构.智能优化 ...
- Struts 2学习(二)
文章目录 @[toc] #动态结果 配置时不知道执行后的结果是哪一个,运行时才知道哪个结果作为视图显示给用户. #全局结果 全局就结果可满足一个包中多个Action共享一个结果. 全局结果位于pack ...