Tuesday, May 3, 2011

10347 - Medians


#include<iostream>
#include<cstdlib>
#include<cmath>
#include<cstdlib>
using namespace std;
int main()
{
    long double p,q,r,s,A;
    //freopen("in.txt","r",stdin);
    while(scanf("%Lf%Lf%Lf",&p,&q,&r)==3)
    {
        s=(p+q+r)/2;
        A=s*(s-p)*(s-q)*(s-r);
        if(A<=0)
            A=-1;
        else
            A=4.0*sqrt(A)/3.0;
        printf("%0.3Lf\n",A);
    }
    exit(0);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.