Advertisement
Guest User

Referência para 11494 (Luiza)

a guest
Feb 29th, 2012
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int x1,y1,x2,y2;
  5.  
  6. bool checkDiags() {
  7.     if (x1-y1==x2-y2) return true;
  8.     if (x1+y1==x2+y2) return true;
  9.     return false;
  10. }
  11.  
  12. int main() {
  13.     while (1) {
  14.         scanf("%d %d %d %d", &x1,&y1,&x2,&y2);
  15.         if (!x1 && !y1 && !x2 && !y2) break;
  16.  
  17.        
  18.         if (x1==x2 && y1==y2) {
  19.             printf("0\n");
  20.             continue;
  21.         }
  22.  
  23.         if (x1==x2 || y1==y2 || checkDiags()) {
  24.             printf("1\n");
  25.             continue;
  26.         }
  27.  
  28.         printf("2\n");
  29.     }
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement