Thursday, July 30, 2015

1433 - Minimum Arc Distance

#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    int T,ox,oy,ax,ay,bx,by,c=1;
    double oa,ab,angle;
//    freopen("check.txt","r",stdin);
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d %d %d %d %d %d", &ox, &oy, &ax, &ay, &bx, &by);
        oa = sqrt((ox-ax)*(ox-ax) + (oy-ay)*(oy-ay));
        ab = sqrt((bx-ax)*(bx-ax) + (by-ay)*(by-ay));
        angle = acos(((2*oa*oa)-ab*ab)/(2*oa*oa));
        printf("Case %d: %.10lf\n", c++, angle*oa);
    }
    return 0;
}

No comments:

Post a Comment

Triathlon

Triathlon - CodeChef # include < bits/stdc++.h > using namespace std ; # define fi first # define se second # define mp ...