当前位置:网站首页>POJ 2208 six lengths of tetrahedron are known, and the volume is calculated
POJ 2208 six lengths of tetrahedron are known, and the volume is calculated
2022-07-06 18:25:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
Pyramids
Time Limit: 1000MS | Memory Limit: 65536K | |||
---|---|---|---|---|
Total Submissions: 2718 | Accepted: 886 | Special Judge |
Description
Recently in Farland, a country in Asia, a famous scientist Mr. Log Archeo has discovered ancient pyramids. But unlike those in Egypt and Central America, they have triangular (not rectangular) foundation. That is, they are tetrahedrons in mathematical sense. In order to find out some important facts about the early society of the country (it is widely believed that the pyramid sizes are in tight connection with Farland ancient calendar), Mr. Archeo needs to know the volume of the pyramids. Unluckily, he has reliable data about their edge lengths only. Please, help him!
Input
The file contains six positive integer numbers not exceeding 1000 separated by spaces, each number is one of the edge lengths of the pyramid ABCD. The order of the edges is the following: AB, AC, AD, BC, BD, CD.
Output
A real number — the volume printed accurate to four digits after decimal point.
Sample Input
1000 1000 1000 3 4 5
Sample Output
Find the height of the tetrahedron according to the edge , Then calculate by formula .
Code :
/* ***********************************************
Author :_rabbit
Created Time :2014/5/9 21:32:01
File Name :5.cpp
************************************************ */
#pragma comment(linker, "/STACK:102400000,102400000")
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <string>
#include <time.h>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;
double volume(double a,double b,double c,double d,double e,double f){
double a2=a*a,b2=b*b,c2=c*c,d2=d*d,e2=e*e,f2=f*f;
double tr1=acos((c2+b2-f2)/(2*b*c));
double tr2=acos((a2+c2-e2)/(2*a*c));
double tr3=acos((a2+b2-d2)/(2*a*b));
double tr4=(tr1+tr2+tr3)/2;
double temp=sqrt(sin(tr4)*sin(tr4-tr1)*sin(tr4-tr2)*sin(tr4-tr3));
return a*b*c*temp/3;
}
int main()
{
//freopen("data.in","r",stdin);
//freopen("data.out","w",stdout);
double a,b,c,d,e,f;
while(cin>>a>>b>>c>>d>>e>>f)printf("%.4f\n",volume(a,b,c,d,e,f));
return 0;
}
Copyright notice : This article is an original blog article . Blog , Without consent , Shall not be reproduced .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/117405.html Link to the original text :https://javaforall.cn
边栏推荐
- 2022 Summer Project Training (III)
- 模板于泛型编程之declval
- d绑定函数
- MS-TCT:Inria&SBU提出用于动作检测的多尺度时间Transformer,效果SOTA!已开源!(CVPR2022)...
- Excellent open source fonts for programmers
- 2022 Summer Project Training (I)
- Grafana 9.0 正式发布!堪称最强!
- 2022暑期项目实训(一)
- 阿里云国际版ECS云服务器无法登录宝塔面板控制台
- 容器里用systemctl运行服务报错:Failed to get D-Bus connection: Operation not permitted(解决方法)
猜你喜欢
Docker安装Redis
[.Net core] solution to error reporting due to too long request length
Implementation of queue
78 year old professor Huake has been chasing dreams for 40 years, and the domestic database reaches dreams to sprint for IPO
關於這次通信故障,我想多說幾句…
Maixll dock camera usage
Penetration test information collection - CDN bypass
Tree-LSTM的一些理解以及DGL代码实现
Ms-tct: INRIA & SBU proposed a multi-scale time transformer for motion detection. The effect is SOTA! Open source! (CVPR2022)...
面向程序员的精品开源字体
随机推荐
Splay
解读云原生技术
Blue Bridge Cup real question: one question with clear code, master three codes
This article discusses the memory layout of objects in the JVM, as well as the principle and application of memory alignment and compression pointer
关于这次通信故障,我想多说几句…
Will openeuler last long
Cocos2d Lua 越来越小样本 内存游戏
Excel usage record
Tree-LSTM的一些理解以及DGL代码实现
Jerry's access to additional information on the dial [article]
Comparative examples of C language pointers *p++, * (p++), * ++p, * (++p), (*p) + +, +(*p)
從交互模型中蒸餾知識!中科大&美團提出VIRT,兼具雙塔模型的效率和交互模型的性能,在文本匹配上實現性能和效率的平衡!...
High precision operation
STM32+ESP8266+MQTT协议连接OneNet物联网平台
Kill -9 system call used by PID to kill process
Why does wechat use SQLite to save chat records?
Jerry's watch reading setting status [chapter]
使用block实现两个页面之间的传统价值观
The latest financial report release + tmall 618 double top, Nike energy leads the next 50 years
从交互模型中蒸馏知识!中科大&美团提出VIRT,兼具双塔模型的效率和交互模型的性能,在文本匹配上实现性能和效率的平衡!...