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

Northeastern Europe 2002, Northern Subregion
Problem: 2208  
Memory: 188K   Time: 47MS
Language: C++   Result: Accepted
 #include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
//p,q,r为AD,BD,CD;n,l,m为AB,BC,AC;
double V_tetrahedron(double l, double m, double n, double q, double p, double r) {
//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;
double x = q*q + r*r - l*l, y = r*r + p*p - m*m, z = p*p + q*q - n*n;
return sqrt(( * p*p*q*q*r*r - p*p*x*x - q*q*y*y - r*r*z*z + z*x*y)) / 12.0;
}
int main(){
double l,m,n,q,p,r;
cin>>n>>m>>p>>l>>q>>r;
double ans=V_tetrahedron(l,m,n,q,p,r);
printf("%.4lf\n",ans);
return ;
}

POJ 2208--Pyramids(欧拉四面体体积计算)的更多相关文章

  1. POJ 2208 Pyramids 欧拉四面体

    给出边长,直接就可以求出体积咯 关于欧拉四面体公式的推导及证明过程 2010-08-16 14:18 1,建议x,y,z直角坐标系.设A.B.C少拿点的坐标分别为(a1,b1,c1),(a2,b2,c ...

  2. HDU 1411--校庆神秘建筑(欧拉四面体体积计算)

    校庆神秘建筑 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  3. POJ 2208 Pyramids(求四面体体积)

    Description Recently in Farland, a country in Asia, a famous scientist Mr. Log Archeo has discovered ...

  4. 欧拉函数 &【POJ 2478】欧拉筛法

    通式: $\phi(x)=x(1-\frac{1}{p_1})(1-\frac{1}{p_2})(1-\frac{1}{p_3}) \cdots (1-\frac{1}{p_n})$ 若n是质数p的k ...

  5. POJ 2480 (约数+欧拉函数)

    题目链接: http://poj.org/problem?id=2480 题目大意:求Σgcd(i,n). 解题思路: 如果i与n互质,gcd(i,n)=1,且总和=欧拉函数phi(n). 如果i与n ...

  6. Poj 2478-Farey Sequence 欧拉函数,素数,线性筛

    Farey Sequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14291   Accepted: 5647 D ...

  7. POJ 2407 Relatives(欧拉函数)

    题目链接 题意 : 求小于等于n中与n互质的数的个数. 思路 : 看数学的时候有一部分是将欧拉函数的,虽然我没怎么看懂,但是模板我记得了,所以直接套了一下模板. 这里是欧拉函数的简介. #includ ...

  8. POJ 1386 有向图欧拉通路

    题意:给你一些字符串,这些字符串可以首位相接(末位置如果和另一个字符串的首位置相同的话就可以相连) .然后问你是否可以全部连起来. 思路:就是取出每个字符串的首尾位置,然后求出出度和入度,根据有向欧拉 ...

  9. poj 2773 利用欧拉函数求互质数

    题意:找到与n互质的第 k个数 开始一看n是1e6 敲了个暴力结果tle了,后来发现k达到了 1e8 所以需要用到欧拉函数. 我们设小于n的 ,与n互质的数为  (a1,a2,a3.......a(p ...

随机推荐

  1. Creator4.2建模心得与技巧1——树的建立与跟随摄像机旋转

    Creator建模: 树一般在虚拟现实程序中都用面来实现,一种方法是通过两个面相互垂直成90度叠放在一起,另一种方法是让树面正对着视角一起旋转.这里主要说一下第二种方法. 主要思路:把树面一直正对着摄 ...

  2. select下拉框默认不能选择第一个选项的问题

    如题,现在有个js的功能:用户选择下拉框的同时,把选择的下拉框显示出来.同时选择的不能有重复的.刚开始 使用的是 select的onchange事件: $("#liveType") ...

  3. 3.获取git仓库

    有两种取得 Git 项目仓库的方法. 第一种是在现有项目或目录下导入所有文件到 Git 中: 第二种是从一个服务器克隆一个现有的 Git 仓库. 在现有目录中初始化仓库 如果你打算使用 Git 来对现 ...

  4. windows远程桌面无法粘贴复制的解决方法

    案例一:未勾选剪贴板,进入 远程桌面连接选项“本地资源->本地设备和资源->剪贴板”中,勾选剪贴板. 案例二:已勾选剪贴板,但是无法粘贴复制,进入远程服务器,关闭[rdpclip.exe] ...

  5. ComboBox赋值ItemsSource数据源的时候会触发SelectionChanged改变事件的解决办法

    我用的方法是设置开关 bool flag = false;//默认开关关闭(全局变量) flag = false;在赋值数据源之前设置关闭box.ItemsSource = lstProperty;/ ...

  6. Web API 2 入门——Web API 2(C#)入门(谷歌翻译)

    ASP.NET Web API 2(C#)入门 在这篇文章中 本教程中使用的软件版本 创建一个Web API项目 添加模型 添加控制器 使用Javascript和jQuery调用Web API 运行应 ...

  7. deepin ubuntu等创建桌面快捷方式

    Linux网上下载软件一般只会有.sh结尾执行程序.并不会像商店下载一样自动创建桌面图标.此时需要自行进行编辑. #创建一个桌面图标后缀名为.desktop touch myDesktop.deskt ...

  8. 索引反向使用案例,加index_desc hint

    drop index idx_t;create index idx_t on t(owner desc,object_type asc); select /*+index(a,idx_t)*/ * f ...

  9. python csv写入数据,消除空行

    import csv rowlist=[{'first_name': 'mark', 'last_name': 'zhao','age':21}, {'first_name': 'tony', 'la ...

  10. python UI自动化实战记录十一: 总结

    首先说说为什么想起来用自动化脚本来实现该项目的自动化. 工作还是以手工测试为主,业务驱动型的项目大概就是这样,业务不停地变,不断的迭代. 自动化测试实施的先决条件: 一 得有时间. 如果有时间大部分的 ...