1323 Tetrahedron
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
32M
Problem types
Allowed languages
C, C++, Java, Python
Description
Being a good coder needs many basic mathematics shills. In computing geometry,the vector operations has theirs special meanings. Now, the problem is that giving you the four vertex points of a tetrahedron, compute the volume of it.
Input
The first line of input contains a integer n,meaning there are n test cases followed. Each test case will contain four lines which represents four points. Each line contains three integers,which mean the x , y and z of a point.(0<n<1000,-500<x,y,z<500).
Output
For each test case,output an double type number one line given with accuracy “10.3” representing the volume of the tetrahedron. If the four point in a same plane,output -1.
Sample
Input
2
1 1 1
2 2 2
3 3 3
4 4 4
0 0 0
5 0 0
0 5 0
0 0 5
Output
-1
20.833
Source: lily
Comments