Sunday, May 1, 2016

UVA 11494 : Queen - solution

Unknown
#include<cstdio>
using namespace std;

int main()
{
    int x1,x2,y1,y2;
    while (scanf("%d%d%d%d",&x1,&y1,&x2,&y2)==4)
    {
        if (!x1 && !x2 && !y1 && !y2) break;
        int delx=x1-x2;
        int dely=y1-y2;
        if (delx<0) delx*=-1;
        if (dely<0) dely*=-1;
        if (x1==x2 && y1==y2) printf("0\n");
        else if (delx==dely || x1==x2||y1==y2 )
        printf("1\n");
        else printf("2\n");
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,