fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void solve() {
  5. int x, y;
  6. cin >> x >> y;
  7. if (x + 1 == y) {
  8. cout << "YES" << endl;
  9. } else if (x <= y) {
  10. cout << "NO" << endl;
  11. } else {
  12. int diff = x - y + 1;
  13. if (diff % 9 == 0) cout << "YES" << endl;
  14. else cout << "NO" << endl;
  15. }
  16. }
  17.  
  18. int main() {
  19. int t;
  20. cin >> t;
  21. while (t--) solve();
  22. }
Success #stdin #stdout 0.01s 5288KB
stdin
7
1 2
77 77
997 999
999 1
1000 1
1 11
18 1
stdout
YES
NO
NO
YES
NO
NO
YES