poj2208Pyramids(四面体面积--公式)

链接

一公式题。。

证明讲解参照http://www.cnblogs.com/dgsrz/articles/2590309.html

注意对棱 顺序

 1 #include <iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<algorithm>
 5 #include<stdlib.h>
 6 #include<vector>
 7 #include<cmath>
 8 #include<queue>
 9 #include<set>
10 using namespace std;
11 #define N 100000
12 #define LL long long
13 #define INF 0xfffffff
14 const double eps = 1e-8;
15 const double pi = acos(-1.0);
16 const double inf = ~0u>>2;
17 
18 int main()
19 {
20     int a,b,c,d,e,f;
21     while(scanf("%d%d%d%d%d%d",&a,&b,&c,&f,&e,&d)!=EOF)
22     {
23         a*=a,b*=b,c*=c,d*=d,e*=e,f*=f;
24         double v=sqrt(1.0*a*d*(b+c+e+f-a-d)+1.0*b*e*(a+c+d+f-b-e)
25                       +1.0*c*f*(a+b+d+e-c-f)-1.0*a*b*f-1.0*b*c*d-1.0*c*a*e-1.0*d*e*f)/12;
26             printf("%.4f
",v);
27     }
28     return 0;
29 }
View Code
原文地址:https://www.cnblogs.com/shangyu/p/3868635.html