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. EasyUI combobox 多选及回显赋值

    multiple boolean 决定是否支持多项选择. $('#cc').combobox({ url:'combobox_data.json', multiple:true, //支持多选 val ...

  2. Unity导出APk出错解决方法二

    错误提示(需得打开编辑器log文件才能看到全部log,Unity3d只显示一部分): Error building Player: CommandInvokationFailure: Unable t ...

  3. Qt判断鼠标在控件上

    QT判断鼠标是否在某子窗口控件上方 需要注意的是,子窗口获取geometry,是相对于父窗口的相对位置,QCursor::pos()获取的是鼠标绝对位置,要不将父窗口的相对位置进行换算,要不将鼠标的绝 ...

  4. sql优化1

    1.mysql里面的索引 对于 like关键字匹配查询,适用于like name%,但是不适用于%name%;添加索引时候注意这点 2.mysql的limit分页 ,limit 2,5;表示每页显示5 ...

  5. 使用SDL2出现 “error LNK2019: 无法解析的外部符号 _SDL_main,该符号在函数 _main 中被引用” 时的可能错误记录

    这几天在使用SDL2,之前一直都没有错,直到上午把项目搬了个地方.结果一直出现 “error LNK2019: 无法解析的外部符号 _SDL_main,该符号在函数 _main 中被引用” . 看了网 ...

  6. Java任务调度框架Quartz入门

    Quartz[kwɔːts]:石英,其框架和名字一样简单朴素又不失魅力,在Java程序界,Quartz大名鼎鼎,很多Java应用几乎都集成或构建了一个定时任务调度系统,Quartz是一个定时任务调度框 ...

  7. java学习笔记之Java的特点

    Java在如今的发展趋势而言,一直都是处于流行的原因自然也是随之而存在的. java的特点如下几个方面: 1.简单性 Java 实际上是一个 C++去掉了复杂性之后的简化版.如果读者没有编程经验,会发 ...

  8. MyCAT详解

    一.MyCAT概述 MyCAT是一款由阿里Cobar演变而来的用于支持数据库读写分离.分片的分布式中间件.MyCAT可不但支持Oracle.MSSQL.MYSQL.PG.DB2关系型数据库,同时也支持 ...

  9. devexpress chart 散点图加载并分组显示(可以自定义颜色 同组中的点颜色相同)

    this.dChart.Diagram.Series.Clear();//清空图的内容 var groups = result.GroupBy(itm => itm["flag&quo ...

  10. Going Deeper with Convolutions(Inception v1)笔记

    目录 Abstract Introduction First of All Inception Depth Related Work Motivation and High Level Conside ...