POJ-2208 Pyramids (Northeastern Europe 2002)
2016-08-22 16:12
260 查看
题目链接:http://poj.org/problem?id=2208
四面体体积计算:
四面体ABCD的体积是V,AB=a,AC=b,AD=c,CD=p,DB=q,BC=r,
设P1=(ap)2(–a2+b2+c2–p2+q2+r2),
P2=(bq)2(a2–b2+c2+p2–q2+r2),
P3=(cr)2(a2+b2–c2+p2+q2–r2),
P=(abr)2+(acq)2+(bcp)2+(pqr)2,
则V=√(P1+P2+P3–P)/12。
四面体体积计算:
四面体ABCD的体积是V,AB=a,AC=b,AD=c,CD=p,DB=q,BC=r,
设P1=(ap)2(–a2+b2+c2–p2+q2+r2),
P2=(bq)2(a2–b2+c2+p2–q2+r2),
P3=(cr)2(a2+b2–c2+p2+q2–r2),
P=(abr)2+(acq)2+(bcp)2+(pqr)2,
则V=√(P1+P2+P3–P)/12。
#include<iostream> using namespace std; #include<math.h> int main() { double a,b,c,p,q,r,P1,P2,P3,V,P; while(cin>>a>>b>>c>>r>>q>>p) { P1=(a*p)*a*p*(-a*a+b*b+c*c-p*p+q*q+r*r); P2=(b*q)*b*q*(a*a-b*b+c*c+p*p-q*q+r*r); P3=(c*r)*(c*r)*(a*a+b*b-c*c+p*p+q*q-r*r); P=(a*b*r)*(a*b*r)+(a*c*q)*(a*c*q)+(b*c*p)*(b*c*p)+(p*q*r)*(p*q*r); V=sqrt((P1+P2+P3-P))/12; printf("%.4f\n",V); } return 0; }
相关文章推荐
- POJ 2208 Pyramids 笔记
- poj 2208 Pyramids
- POJ 2208 Pyramids&&HDU 1411 校庆神秘建筑(欧拉四面体公式)
- POJ 2208 Pyramids 计算几何 四面体体积
- POJ 2208 Pyramids(欧拉四面体公式)
- POJ 2208 Pyramids(求四面体体积)
- POJ 2208 Pyramids(四面体体积)
- POJ 2208 Pyramids 欧拉四面体
- POJ-2208 Pyramids解题报告
- POJ 2002 Squares(哈希表)
- POJ2002 &&HDU5365 判断给定的点中有多少个不同的正方形
- Poj 2002 Squares
- 【CEOI2002】【Poj 1038】Bugs Integrated, Inc.
- POJ 2002 Squares(简单的二分)
- poj 1226 hdu 1238 Substrings 求若干字符串正串及反串的最长公共子串 2002亚洲赛天津预选题
- poj 2002 Squares 几何二分 || 哈希
- poj 2002 Squares ----二分
- poj 2002 Squares Hash
- POJ2002_Squares (哈希表)
- POJ 2002 Squares【值得摸索的一道二分+点旋转】