Powered by Blogger.

Sunday, March 17, 2013

acm 10195 The knights of The Round Table

#include<stdio.h>
#include<math.h>
int main()
{
    long double a,b,c,p,k,r;
    while(scanf("%Lf %Lf %Lf",&a,&b,&c)!=EOF)
    {
        if(a<=0||b<=0||c<=0)
        {
            printf("The radius of the round table is: 0.000\n");
        }
        else
        {
            k=(a+b+c)/2;
            p=sqrt(k*(k-a)*(k-b)*(k-c));
            r=p/k;
            printf("The radius of the round table is: %.3Lf\n",r);
        }
    }
    return 0;
}

0 comments:

Post a Comment