Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <cmath>
  4. #include <algorithm>
  5. #include <set>
  6. #include <iterator>
  7. #include <iomanip>
  8. #include <queue>
  9.  
  10. #define pb push_back
  11. #define pop pop_back
  12. #define ff(element,start,end) for(auto element = start ; element < end ; element++)
  13. #define re return
  14. #define fi first
  15. #define se second
  16. #define sz(a) (int)a.size()
  17.  
  18.  
  19. using namespace std;
  20.  
  21.  
  22. typedef long long ll ;
  23. typedef long double ld;
  24. typedef vector<int> vi;
  25. typedef vector<long long> vll;
  26. typedef pair<int,int> pii;
  27. typedef string str;
  28. typedef set<int> si;
  29. typedef multiset<int> msi;
  30.  
  31. int main()
  32. {
  33. ios::sync_with_stdio(0);
  34. cin.tie(0); cout.tie(0);
  35. int n,t[11];
  36. cin >> n;
  37. ff(i,0,n)
  38. cin >> t[i];
  39. ff(i,0,n)
  40. {
  41. if(t[i] % 10 >= 2 && t[i] % 10 <= 8)
  42. cout << "Yes\n";
  43. else
  44. {
  45. if((t[i]+1) % 10 + ((t[i]+1) / 10) % 10 + ((t[i]+1)/100) % 10 == ((t[i]+1) / 1000) % 10 + ((t[i]+1)/10000) % 10 + ((t[i]+1)/100000) % 10 || (t[i]-1) % 10 + ((t[i]-1) / 10) % 10 + ((t[i]-1)/100) % 10 == ((t[i]-1) / 1000) % 10 + ((t[i]-1)/10000) % 10 + ((t[i]-1)/100000) % 10)
  46. cout << "Yes\n";
  47. else
  48. cout << "No\n";
  49. }
  50. }
  51. re 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement