Pyramids
| Time Limit:1000 MS |
|
Memory Limit:65536 K |
| Total Submissions:2718 |
|
Accepted:886 |
|
Special Judge |
Description
Recently in Farland, a country in Asia, a famous scientist Mr. log Archeo has discovered encryption ent 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 co Nnection with Farland login ent 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
Calculate the height of the triangle according to the edge, and then calculate the formula.
Code:
/* ***********************************************Author :_rabbitCreated Time :2014/5/9 21:32:01File Name :5.cpp************************************************ */#pragma comment(linker, "/STACK:102400000,102400000")#include
#include
#include #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
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;}