Wednesday, 11 February 2015

Solution Of Light oj 1305

#include<stdio.h>
#include<stdlib.h>
int main()
{
    int Ax,Ay,Bx,By,Cx,Cy,Dx,Dy,j=0,TEST,area;
    scanf("%d",&TEST);
    while(TEST--){
    scanf("%d%d%d%d%d%d",&Ax,&Ay,&Bx,&By,&Cx,&Cy);
    Dx=(Ax+Cx)-Bx;
    Dy=(Ay+Cy)-By;
    area=((Ax*By)+(Bx*Cy)+(Cx*Dy)+(Dx*Ay))-((Ay*Bx)+(By*Cx)+(Cy*Dx)+(Dy*Ax));
    area=0.5*area;
    printf("Case %d: %d %d %d\n",++j,Dx,Dy,abs(area));
    }

    return 0;
}

No comments:

Post a Comment