博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
POJ 2208--Pyramids(欧拉四面体体积计算)
阅读量:6378 次
发布时间:2019-06-23

本文共 2060 字,大约阅读时间需要 6 分钟。

Pyramids
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 3451   Accepted: 1123   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

1999.9938

Source

, Northern Subregion

 

Problem:   
Memory: 188K   Time: 47MS
Language: C++   Result: Accepted
1 #include
2 #include
3 #include
4 #include
5 using namespace std; 6 //p,q,r为AD,BD,CD;n,l,m为AB,BC,AC; 7 double V_tetrahedron(double l, double m, double n, double q, double p, double r) { 8 //return sqrt((4 * p*p*q*q*r*r - p*p*(q*q + r*r - l*l)*(q*q + r*r - l*l) - q*q*(r*r + p*p - m*m)*(r*r + p*p - m*m) - r*r*(p*p + q*q - n*n)*(p*p + q*q - n*n) + (p*p + q*q - n*n)*(q*q + r*r - l*l)*(r*r + p*p - m*m))) / 12.0; 9 double x = q*q + r*r - l*l, y = r*r + p*p - m*m, z = p*p + q*q - n*n;10 return sqrt((4 * p*p*q*q*r*r - p*p*x*x - q*q*y*y - r*r*z*z + z*x*y)) / 12.0;11 }12 int main(){13 double l,m,n,q,p,r;14 cin>>n>>m>>p>>l>>q>>r;15 double ans=V_tetrahedron(l,m,n,q,p,r);16 printf("%.4lf\n",ans);17 return 0;18 }
View Code

 

转载于:https://www.cnblogs.com/FlyerBird/p/9518178.html

你可能感兴趣的文章
一道柯里化面试题
查看>>
本科studying abroad 无法毕业申请硕士转学转校处理一切studying abroad 问题
查看>>
RxJava(RxAndroid)的简单学习
查看>>
Java8 函数式编程之函数接口(下)
查看>>
【本人秃顶程序员】MySQL 全表 COUNT(*) 简述
查看>>
centos7中使用febootstrap自制一个基础的centos 7.2的docker镜像
查看>>
C#开发Unity游戏教程之判断语句
查看>>
安装 SharePoint Server 2007
查看>>
springmvc mybatis 调用sql , 转成json
查看>>
linux centos 7 网卡突然不能上网异常解决
查看>>
授之以渔-运维平台发布模块一(Jenkins篇)
查看>>
DedeCMS操作基础(一)
查看>>
实现MySQL允许远程连接
查看>>
Java Outputstream to String
查看>>
RS232C串口通信接线方法(三线制)
查看>>
Android 自定义View属性相关细节
查看>>
type already defined error in Eclipse
查看>>
OSA 安装
查看>>
先安装.Framework然后再安装IIS,ASP.NET程序不能运行
查看>>
NPOI Excel下拉项生成设置
查看>>