Pyramids
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 2718   Accepted: 886   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

依据边来求出四面体的高,然后公式计算。

代码:

/* ***********************************************
Author :_rabbit
Created Time :2014/5/9 21:32:01
File Name :5.cpp
************************************************ */
#pragma comment(linker, "/STACK:102400000,102400000")
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <string>
#include <time.h>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;
double volume(double a,double b,double c,double d,double e,double f){
double a2=a*a,b2=b*b,c2=c*c,d2=d*d,e2=e*e,f2=f*f;
double tr1=acos((c2+b2-f2)/(2*b*c));
double tr2=acos((a2+c2-e2)/(2*a*c));
double tr3=acos((a2+b2-d2)/(2*a*b));
double tr4=(tr1+tr2+tr3)/2;
double temp=sqrt(sin(tr4)*sin(tr4-tr1)*sin(tr4-tr2)*sin(tr4-tr3));
return a*b*c*temp/3;
}
int main()
{
//freopen("data.in","r",stdin);
//freopen("data.out","w",stdout);
double a,b,c,d,e,f;
while(cin>>a>>b>>c>>d>>e>>f)printf("%.4f\n",volume(a,b,c,d,e,f));
return 0;
}

版权声明:本文博客原创文章。博客,未经同意,不得转载。

POJ 2208 已知边四面体六个长度,计算体积的更多相关文章

  1. JAVA-集合作业-已知有十六支男子足球队参加2008 北京奥运会。写一个程序,把这16 支球队随机分为4 个组。采用List集合和随机数

    第二题 已知有十六支男子足球队参加2008 北京奥运会.写一个程序,把这16 支球队随机分为4 个组.采用List集合和随机数 2008 北京奥运会男足参赛国家: 科特迪瓦,阿根廷,澳大利亚,塞尔维亚 ...

  2. 已知一个字符串S 以及长度为n的字符数组a,编写一个函数,统计a中每个字符在字符串中的出现次数

    import java.util.Scanner; /** * @author:(LiberHome) * @date:Created in 2019/3/6 21:04 * @description ...

  3. 在Excel中,已知身份证号码,如何批量计算其实际年龄?

    昨天,上司问我:..,你会在Excel中计算年龄吗?当时,一下促住了.说真的,还真不会.今天研究了一下,写下来,方便日后查看. 首先,得有一张已知姓名和相应身份证号的原表吧. 在这张表上再加上三列:出 ...

  4. POJ 2208 Pyramids 欧拉四面体

    给出边长,直接就可以求出体积咯 关于欧拉四面体公式的推导及证明过程 2010-08-16 14:18 1,建议x,y,z直角坐标系.设A.B.C少拿点的坐标分别为(a1,b1,c1),(a2,b2,c ...

  5. POJ 2208 Pyramids(求四面体体积)

    Description Recently in Farland, a country in Asia, a famous scientist Mr. Log Archeo has discovered ...

  6. 第二题 已知有十六支男子足球队参加2008 北京奥运会。写一个程序,把这16 支球队随机分为4 个组。采用List集合和随机数 2008 北京奥运会男足参赛国家: 科特迪瓦,阿根廷,澳大利亚,塞尔维亚,荷兰,尼日利亚、日本,美国,中国,新西 兰,巴西,比利时,韩国,喀麦隆,洪都拉斯,意大利

    package com.hanqi.test; import java.util.ArrayList; import java.util.List; import java.util.Random; ...

  7. 已知有十六支男子足球队参加2008 北京奥运会。写一个程序,把这16 支球队随机分为4 个组。采用List集合和随机数

      package homework002; import java.util.ArrayList; import java.util.List; import java.util.Random; p ...

  8. 第二题 已知有十六支男子足球队参加2008 北京奥运会。写一个程序,把这16 支球队随机分为4 个组。采用List集合和随机数     2008 北京奥运会男足参赛国家:  科特迪瓦,阿根廷,澳大利亚,塞尔维亚,荷兰,尼日利亚、日本,美国,中国,新西 兰,巴西,比利时,韩国,喀麦隆,洪都拉斯,意大利

    import java.util.ArrayList; import java.util.List; import java.util.Random; public class List1 { pub ...

  9. poj 2242(已知三点求外接圆周长)

    The Circumference of the Circle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8310   ...

随机推荐

  1. WebApi异常

    WebApi异常处理解决方案   前言:上篇C#进阶系列——WebApi接口传参不再困惑:传参详解介绍了WebApi参数的传递,这篇来看看WebApi里面异常的处理.关于异常处理,作为程序员的我们肯定 ...

  2. Maven + Jetty + Jersey搭建RESTful服务

    IntelliJ IDEA + Maven + Jetty + Jersey搭建RESTful服务 本文参考以下内容: 使用Jersey实现RESTful风格的webservice(一) Starti ...

  3. SWT的TreeVierer的使用

    先看一下效果图: 代码结构是这样的: 好的,现在看一下代码: package model; import java.util.List; public interface ITree { public ...

  4. JS 在 HTML 中做加减乘除

    <script type="text/javascript"> function fun(t){ var fa = parseInt(document.getEleme ...

  5. TextBox自定义Mac输入框类

    using System.Windows.Controls; namespace test { public class MacTextBox : TextBox { private string _ ...

  6. 执行Sql块

    import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import oracle.C ...

  7. JAVA网络编程Socket常见问题 【长连接专题】

    一. 网络程序运行过程中的常见异常及处理 第1个异常是 java.net.BindException:Address already in use: JVM_Bind. 该异常发生在服务器端进行new ...

  8. 1008: University

    &method=showdetail&id=1008" style="background-color:rgb(255,0,0)">台州ACM:10 ...

  9. cocos2d-x适配多分辨率

    现在用的2d-x版本是2.1.1.现在的项目要求是iphone ,iphone Retina,ipad和ipad Retina都有各自的路径来存放各自需要的资源.在AppDelegate的 appli ...

  10. ftp的主动模式(port)与被动模式(PASV) (转)

    FTP是仅基于TCP的服务,不支持UDP.与众不同的是FTP使用2个端口,一个数据端口和一个命令端口(也可叫做控制端口).通常来说这两个端口是21(命令端口)和20(数据端口).但FTP工作方式的不同 ...