HII GUYS this is the Geometry based problem.......
Here are some important points regarding tetrahedron.
1.there are total 4 faces of a tetrahedron
2.how to find area of one face so u know that this is a triangle
u can find its area by Hero's formula
Hero's formula is ::::
let sides of a triangle are a,b,c
then perimeter(s) is equal to 2*s=(a+b+c)
area of triangle =sqrt(s*(s-a)*(s-b)*(s-c))
3.BY this u can find area of every triangle
then let total area of all faces is equal to T=area1+area2+area3+area4
4.how to find volume for this i m giving u a link there u can find out
that how to calculate volume in terms of sides
link::http://en.wikipedia.org/wiki/Tetrahedron
5.after calculating volume u can use formula for radius of insphere is
=V*3/T
where V is volume
and T is surface area as i mentioned above..........
6.for volume u can also use this formula
vol=sqrt(4*u*u*v*v*w*w- u*u*(v*v+w*w - U*U)*(v*v+w*w-U*U) - v*v*(w*w+u*u - V*V)*(w*w+u*u-V*V) - w*w*(u*u + v*v - W*W)*(u*u+v*v-W*W) + (v*v +w*w - U*U)*(w*w+u*u- V*V)*(u*u+v*v - W*W))/12
where u,v,w,W,V,U are sides of tetrahedron.....
if still u have u can see my AC SOLUTION>>>>>>>>>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 | #include<bits/stdc++.h>
using namespace std;
double area(double ,double ,double );
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
double u,v,w,U,V,W;
scanf("%lf %lf %lf %lf %lf %lf",&u,&v,&w,&W,&V,&U);
double vol;
double S=0;
S+=area(u,V,w);
S+=area(W,u,v);
S+=area(W,V,U);
S+=area(U,v,w);
vol=sqrt(4*u*u*v*v*w*w- u*u*(v*v+w*w - U*U)*(v*v+w*w-U*U) - v*v*(w*w+u*u - V*V)*(w*w+u*u-V*V) - w*w*(u*u + v*v - W*W)*(u*u+v*v-W*W) + (v*v +w*w - U*U)*(w*w+u*u- V*V)*(u*u+v*v - W*W))/12;
printf("%.4lf\n",vol*3.0/S);
}
return 0;
}
double area(double a1,double a2,double a3)
{
double s=(a1+a2+a3)/2.0;
return sqrt(s*(s-a1)*(s-a2)*(s-a3));
}
|
No comments:
Post a Comment