当前位置:网站首页>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 5Sample 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
边栏推荐
- Automatic reservation of air tickets in C language
- 首先看K一个难看的数字
- The third season of Baidu online AI competition is coming in midsummer, looking for you who love AI!
- 2022/02/12
- Compilation Principle -- C language implementation of prediction table
- Interesting - questions about undefined
- Splay
- 2022暑期项目实训(二)
- 1700C - Helping the Nature
- Jerry's watch reading setting status [chapter]
猜你喜欢

30 分钟看懂 PCA 主成分分析

重磅硬核 | 一文聊透对象在 JVM 中的内存布局,以及内存对齐和压缩指针的原理及应用

Introduction to the usage of model view delegate principal-agent mechanism in QT

使用cpolar建立一个商业网站(1)

STM32 key state machine 2 - state simplification and long press function addition

Maixll dock camera usage
![[swoole series 2.1] run the swoole first](/img/cd/88abf7e83e9d9d416051b33263690b.png)
[swoole series 2.1] run the swoole first

Four processes of program operation

Rb157-asemi rectifier bridge RB157

Windows连接Linux上安装的Redis
随机推荐
C language exchanges two numbers through pointers
Markdown syntax for document editing (typera)
78 year old professor Huake has been chasing dreams for 40 years, and the domestic database reaches dreams to sprint for IPO
【LeetCode第 300 场周赛】
MSF horizontal MSF port forwarding + routing table +socks5+proxychains
node の SQLite
Comparative examples of C language pointers *p++, * (p++), * ++p, * (++p), (*p) + +, +(*p)
D binding function
Will openeuler last long
[sword finger offer] 60 Points of N dice
虚拟机VirtualBox和Vagrant安装
F200 - UAV equipped with domestic open source flight control system based on Model Design
Jielizhi obtains the customized background information corresponding to the specified dial [chapter]
STM32+ENC28J60+UIP协议栈实现WEB服务器示例
使用cpolar建立一个商业网站(1)
Reprint: defect detection technology of industrial components based on deep learning
High precision operation
CSRF漏洞分析
STM32+MFRC522完成IC卡号读取、密码修改、数据读写
解读云原生技术