Advertisement
Promi_38

cf 1311A

Oct 2nd, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int t;
  8.     scanf("%d", &t);
  9.    
  10.     while(t--)
  11.     {
  12.         int a, b;
  13.         scanf("%d %d", &a, &b);
  14.        
  15.         if(a == b)
  16.         {
  17.             printf("0\n");
  18.         }
  19.         else if(a > b)
  20.         {
  21.             if((a - b) % 2 == 0) printf("1\n");
  22.             else printf("2\n");
  23.         }
  24.         else
  25.         {
  26.             if((b - a) % 2 == 0) printf("2\n");
  27.             else printf("1\n");
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement