欧拉四面体公式:
知道这个就可以做了啊。
校庆神秘建筑
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1564 Accepted Submission(s): 489
Problem Description
杭州电子科技大学即将迎来50周年的校庆,作为校庆委员会成员的我被上级要求设计一座神秘的建筑物来迎合校庆,因此我苦思冥想了一个月,终于设计出了一套方案,这座建筑物有点象古老埃及的金字塔,不过这个神秘建筑的根基是三角形的而不是矩形的,从数学的专业角度来讲,它是四面体。当我打算上交我的设计图纸的时候发现,我不知道怎么计算这个神秘建筑的体积(我知道这座建筑的各边的尺寸),于是我找来了聪明的你来帮助我解决这个难题。
Input
输入文件包含6个不超过1000的实数,每个数之间用空格隔开。每个数代表金字塔ABCD的一条棱边长度,棱边排序如下:AB,AC,AD,BC,BD,CD。
Output
输出数据应是一个实数,表示金字塔的体积,精确到4位小数。
Sample Input
2 2 2 2 2 2
Sample Output
0.9428
#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#define eps 1e-8
#define M 1000100
//#define LL __int64
#define LL long long
#define INF 0x3f3f3f3f
#define PI 3.1415926535898
const int maxn = 5010;
using namespace std;
int main()
{
double a, b, c, d, e, f;
while(~scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f))
{
double s1, s2, s3, s4;
double cnt;
double p;
s1 = acos((c*c + b*b - f*f)/(2.0*b*c));
s2 = acos((a*a + c*c - e*e)/(2.0*a*c));
s3 = acos((a*a + b*b - d*d)/(2.0*a*b));
s4 = (s1 + s2 + s3)/2.0;
cnt = sqrt(sin(s4) * sin(s4-s1) * sin(s4-s2) * sin(s4-s3));
p = a*b*c*cnt/3.0;
printf("%.4lf\n",p);
}
return 0;
}