POJ 2208 Pyramids&&HDU 1411 校庆神秘建筑(欧拉四面体公式)

130 篇文章 0 订阅
15 篇文章 0 订阅

欧拉四面体公式:

知道这个就可以做了啊。

校庆神秘建筑

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;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值