Advertisement
juanjo12x

UVA_10849_Move_The_Bishop

Jul 27th, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <cstring>
  5. #include <string>
  6. #include <cctype>
  7. #include <stack>
  8. #include <queue>
  9. #include <list>
  10. #include <vector>
  11. #include <map>
  12. #include <set>
  13. #include <sstream>
  14. #include <stdlib.h>
  15. #define LL unsigned long long
  16. using namespace std;
  17.  
  18. int main()
  19. {   int t,t2;
  20.     long n,x1,x2,y1,y2,i,j;
  21.     scanf("%d",&t);
  22.     for(i=0;i<t;i++){
  23.         scanf("%d",&t2);
  24.         scanf("%ld",&n);
  25.         for(j=0;j<t2;j++){
  26.             scanf("%ld %ld %ld %ld",&x1,&y1,&x2,&y2);
  27.             if(((x1+y1)%2) !=((x2+y2)%2)
  28.                || x1>n || x2>n || y1>n || y2>n
  29.                || x1<1 || x2<1 || y1<1 || y2<1)
  30.                 puts("no move");
  31.             else if(x1==x2 && y1==y2)
  32.                 puts("0");
  33.             else if(abs(x2-x1)==abs(y2-y1))
  34.                 puts("1");
  35.             else
  36.                 puts("2");
  37.         }
  38.     }
  39.        return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement