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

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

最新文章

  1. Android之genymotion模拟器安装于配置
  2. 事件--c#
  3. GNOME启动时激活NumLock(小键盘数字锁定)
  4. MDT 2010驱动管理新方法。
  5. C语言100个经典算法
  6. bootstrap-fileinput初体验
  7. telnet命令判断端口是否通不通
  8. iOS 打开系统设置
  9. [C++]让CPU使用率曲线呈现为正弦曲线(一)
  10. 过目不忘JS正则表达式(转)
  11. vue echarts 动态数据
  12. hdu 4825 &amp;&amp; acdream 1063 01字典树异或问题
  13. NYOJ 47:过河问题(思维)
  14. 如何删除GitHub中已经建好的仓库(repository)
  15. spring处理线程并发
  16. mysql数据出现Unknown column &#39;user_uid&#39; in &#39;field list&#39; sql错误
  17. 08:Python数据分析之pandas学习
  18. [AT2268] [agc008_f] Black Radius
  19. list C++实现
  20. Type Script在Visual Studio 2013中的问题汇总(持续更新…)

热门文章

  1. 转:svn命令行操作
  2. VMware GSX Server 3.2.1 Build 19281免费下载
  3. 【NIO】dawn在buffer用法
  4. 《Linux Device Drivers》 第十七章 网络驱动程序——note
  5. 2014在辛星Javascript口译科
  6. 怎么确定你的CPU是否支持64位虚拟化
  7. Visual Prolog 的 Web 专家系统 (7)
  8. 移动web:图片切换(焦点图)
  9. JTree demo
  10. Facebook新框架React Native,一套搞定App开发[转]