Sunday, July 17, 2016

UVA 438 SOLUTION

Unknown
#include<cstdio>
#include<cmath>
using namespace std;

#define pi 3.141592653589793

int main()
{
    double x1,x2,x3,y1,y2,y3,a,b,c,s,r,cir;
    while (scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF)
    {
        a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
        b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
        c=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
        s=(a+b+c)/2.0;
        r=a*b*c/(4*sqrt(s*(s-a)*(s-b)*(s-c)));
        cir=2*pi*r;
        printf("%.2lf\n",cir);
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,