Untitled
raw download clone
TEXT
views 70
,
size 884 b
#include<math.h>
#include<stdio.h>
double triarea(double a1,double a2,double a3)
{
    double s=(a1+a2+a3)/2,a;
    a=sqrt(s*(s-a1)*(s-a3)*(s-a2));
    return a;
}
double circle(double ang, double rad)
{
    double a=ang*rad;
    return a;
}
double angle(double a1,double a2,double a3)
{
    double a=acos((a2*a2+a3*a3-a1*a1)/(2*a2*a3));
    return a;
}
int main()
{
    int t,i;
    double r1,r2,r3,ang1,ang2,ang3;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%lf %lf %lf",&r1,&r2,&r3);
        double f1=(r2+r3),f2=r1+r3,f3=r1+r2;
        double tri,c1,c2,c3;
        tri=triarea(f1,f2,f3);
        ang1=angle(f1,f2,f3);
        ang2=angle(f2,f1,f3);
        ang3=angle(f3,f1,f2);
        c1=circle(ang1,r1);
        c2=circle(ang2,r2);
        c3=circle(ang3,r3);
        printf("Case %d: %.8lf\n",i,tri-(c1+c2+c3));
    }
}
close fullscreen
Login or Register to edit or fork this paste. It's free.