... HAVE U TRIED .... AT LEAST 3 TIMES ... OK U CAN SEE THIS ...

Tuesday, December 31, 2013

LOJ-1433 :: Minimum Arc Distance

#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main ()
{
    double x1,x2,x3,y1,y2,y3 ,a,b,c ,C ,s ;
    int i ,t ;
    cin>>t;

    for (i=1 ; i<=t ; i++)
    {
        cin>>x1>>y1>>x2>>y2>>x3>>y3 ;
        a=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3) ) ;
        b=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2) ) ;
        c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3) ) ;

       C=acos( (a*a+b*b-c*c)/(2.0*a*b) ) ;
       s=b*C ;
       printf ("Case %d: %.10lf\n",i,s) ;
    }

    return 0 ;
}