Sunday, June 26, 2016

UVA 11152 Solution

Unknown
#include<cstdio>
#include<math.h>
using namespace std;

#define pi acos(-1)

int main()
{
    double a,b,c;
    while (scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
    {
        double s=(a+b+c)/2.0;
        double triangle_area      =  sqrt(s*(s-a)*(s-b)*(s-c));
        double incircle_radius    =  triangle_area/s;
        double incircle_area      =  pi*incircle_radius*incircle_radius;
        double circumcircle_radius=a*b*c/sqrt((a+b+c)*(a+b-c)*(a-b+c)*(b+c-a));
        double circumcircle_area  =  pi*circumcircle_radius*circumcircle_radius;
        double sunflower = circumcircle_area-triangle_area;
        double violet = triangle_area-incircle_area;
        double red = incircle_area;
       
        printf("%.4lf %.4lf %.4lf\n",sunflower,violet,red);
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,