Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long int int64;
  4. #define MOD 1000000007
  5.  
  6.  
  7.  
  8. int main() {
  9.  
  10. int T; cin >> T;
  11.  
  12. while (T--) {
  13.  
  14. int a, b; cin >> a >> b;
  15.  
  16. if (a == b) cout << "0\n";
  17. else if (a > b && abs(a - b)%2 == 0) cout << "1\n";
  18. else if (a > b && abs(a - b)%2 == 1) cout << "2\n";
  19. else if (a < b && abs(a - b)%2 == 0) cout << "2\n";
  20. else if (a < b && abs(a - b)%2 == 1) cout << "1\n";
  21.  
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement