当前位置:网站首页>POJ 2208 已知边四面体六个长度,计算体积
POJ 2208 已知边四面体六个长度,计算体积
2022-07-06 10:20:00 【全栈程序员站长】
大家好,又见面了,我是全栈君。
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
依据边来求出四面体的高,然后公式计算。
代码:
/* ***********************************************
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;
}
版权声明:本文博客原创文章。博客,未经同意,不得转载。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/117405.html原文链接:https://javaforall.cn
边栏推荐
- Dichotomy (integer dichotomy, real dichotomy)
- 2022暑期项目实训(一)
- 首先看K一个难看的数字
- HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
- 阿里云国际版ECS云服务器无法登录宝塔面板控制台
- STM32 key state machine 2 - state simplification and long press function addition
- Kivy tutorial: support Chinese in Kivy to build cross platform applications (tutorial includes source code)
- Running the service with systemctl in the container reports an error: failed to get D-Bus connection: operation not permitted (solution)
- 重磅硬核 | 一文聊透对象在 JVM 中的内存布局,以及内存对齐和压缩指针的原理及应用
- MSF横向之MSF端口转发+路由表+SOCKS5+proxychains
猜你喜欢
【Swoole系列2.1】先把Swoole跑起来
Getting started with pytest ----- allow generate report
FMT open source self driving instrument | FMT middleware: a high real-time distributed log module Mlog
传输层 拥塞控制-慢开始和拥塞避免 快重传 快恢复
Jerry is the custom background specified by the currently used dial enable [chapter]
Recursive way
MS-TCT:Inria&SBU提出用于动作检测的多尺度时间Transformer,效果SOTA!已开源!(CVPR2022)...
QT中Model-View-Delegate委托代理机制用法介绍
Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
1700C - Helping the Nature
随机推荐
TOP命令详解
Common - magic number 7
Nodejs developer roadmap 2022 zero foundation Learning Guide
Wchars, coding, standards and portability - wchars, encodings, standards and portability
关于这次通信故障,我想多说几句…
Is it meaningful for 8-bit MCU to run RTOS?
Recommend easy-to-use backstage management scaffolding, everyone open source
The third season of Baidu online AI competition is coming in midsummer, looking for you who love AI!
Jerry's watch reads the file through the file name [chapter]
30 minutes to understand PCA principal component analysis
IP, subnet mask, gateway, default gateway
UDP protocol: simple because of good nature, it is inevitable to encounter "city can play"
微信为什么使用 SQLite 保存聊天记录?
当保存参数使用结构体时必备的开发技巧方式
Compilation principle - top-down analysis and recursive descent analysis construction (notes)
Jerry's watch deletes the existing dial file [chapter]
Jielizhi obtains the currently used dial information [chapter]
队列的实现
d绑定函数
Open source and safe "song of ice and fire"