Advertisement
juanjo12x

UVA_11494_Queen

Jul 27th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 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. #include <cmath>
  16. #define LL unsigned long long
  17.  
  18. int main() {
  19.     int x1,x2,y1,y2,dif1,dif2;
  20.     while(scanf("%d %d %d %d",&x1,&y1,&x2,&y2)){
  21.         if(x1==0 && y1==0 && x2==0 && y2==0) break;
  22.         dif1=abs(x1-x2); dif2=abs(y2-y1);
  23.         if(x1==x2 && y1==y2) printf("0\n");
  24.         else if(x1==x2 && y1!=y2) printf("1\n");
  25.         else if (y1==y2 && x1!=x2) printf("1\n");
  26.         else if( dif1==dif2) printf("1\n");
  27.         else printf("2\n");
  28.     }
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement