Showing posts with label Geometry. Show all posts
Showing posts with label Geometry. Show all posts

10195 - The Knights Of The Round Table

 10195 - The Knights Of The Round Table



                              



10195 - The Knights Of The Round Table


#include<bits/stdc++.h>
using namespace std;
#define pi 3.141592653589793

int main()
{
    double a,b,c;
    while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
    {
        if(a+b+c==0)
            printf("The radius of the round table is: 0.000\n");

        else
        {
           double s,r;
           s=(a+b+c)/2;
           r=(s-a)*(s-b)*(s-c)/s;
           printf("The radius of the round table is: %.3lf\n",sqrt(r));

        }
    }
    return 0;
}

438 - The Circumference of the Circle

 438 - The Circumference of the Circle

                   

438 - The Circumference of the Circle






#include<bits/stdc++.h>
using namespace std;
#define pi 3.141592653589793
double dist(double x1,double y1,double x2,double y2)
{
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

int main()
{
    double x1,x2,x3,y1,y2,y3;
    while(scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF)
    {
        double a,b,c;
        a=dist(x1,y1,x2,y2);
        b=dist(x1,y1,x3,y3);
        c=dist(x3,y3,x2,y2);

        double r=(a*b*c)/sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c));
        //cout<<r<<endl;
        r=2*pi*r;

        printf("%.2lf\n",r);

    }

    return 0;
}