UVa Problem 10347 ( Medians) Solution

Problem Solving, UVa

 

#include <bits/stdc++.h>

#include <math.h>



using namespace std;



int main()

{



 double  a,b,c,ans,s;



 while(scanf("%lf %lf %lf",&a,&b,&c) == 3 )

 {



 s=(a+b+c)/2;

 ans=sqrt(s*(s-a)*(s-b)*(s-c));

 if(ans>0)

 printf("%.3lf\n",ans*(4.0/3.0));

 else

 {

 ans=-1;

 printf("%.3lf\n",ans);

 }

 }



return 0;

}

 

0 Comments

You may find interest following article