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. 2-2 Sass的函数功能-字符串与数字函数

    Sass的函数简介 在 Sass 中除了可以定义变量,具有 @extend.%placeholder 和 mixins 等特性之外,还自备了一系列的函数功能.其主要包括: 字符串函数 数字函数 列表函 ...

  2. RocketMQ读书笔记5——消息队列的核心机制

    [Broker简述] Broker是RocketMQ的核心,大部分“重量级”的工作都是由Broker完成的,包括: 1.接受Producer发过来的消息: 2.处理Consumer的消费信息请求: 3 ...

  3. 浅谈PVC塑料配方计算软件的设计

    1, 配方设计与配方计算 题目是配方计算,不是配方设计,设计是需要有深厚的塑料知识才可以做的,即生产什么塑料产品,需要放各种原料是什么,各自比较是多少,遇到什么情况下就要多放什么,少放什么.配方设计不 ...

  4. SpringBoot框架下基于Junit的单元测试

    前言 Junit是一个Java语言的单元测试框架,被开发者用于实施对应用程序的单元测试,加快程序编制速度,同时提高编码的质量.是一个在发展,现在已经到junit5,在javaEE开发中与很多框架相集成 ...

  5. 116.001 - 爱折腾之用 Kindle 读学术论文是什么体验?

    @(116 - Kindle 使用指南) 结论先行 - 强烈安利k2pdfopt,把双栏论文转成kindle友好的pdf 整理转载自知乎@ wei huang 双栏学术论文在6寸屏上看就是个坑 新买的 ...

  6. VS2015开发环境的搭建

    下面我教大家如何搭建VS2015 [环境]我的环境WIN8.1专业版(Ghost) [过程] [1]打开我们的附件vs2015.ent_chs.iso然后我们会进入到这个ISO文件中(windows版 ...

  7. 二、Flex 布局教程:实例篇

    注:本文转自大神阮一峰,自己加了少许改动~ 上一篇文章介绍了Flex布局的语法,今天介绍常见布局的Flex写法. 你会看到,不管是什么布局,Flex往往都可以几行命令搞定. 我只列出代码,详细的语法解 ...

  8. makefile 通配符了解% $@ $^ $<

    把目录下所有文件都编译的命令. 1 all:$(subst .c,.o,$(wildcard *.c)) 2 3 %.o:%.c 4 gcc -o $@ $< 下面是几个特舒符号的意思: $@: ...

  9. SQL Server 有序GUID,SequentialGuid,

    问题描述 有序的GUID性能对比,堪比自增ID integer 一个大神告诉我NEWSEQUENTIALID() 在数据迁移的时候会有问题(感谢大神指点),所以我就深挖一下这个函数. 关于NEWSEQ ...

  10. 修改Tomcat8w.exe可执行路径:Path to executable

    学习java web时,先下载了Tomcat8.5,在Eclipse中配置了Tomcat的相关环境后,出现了个别版本不兼容问题,就打算换成8.0版本.但是删除整个8.5的文件夹后,运行8.0bin中的 ...