Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cmath>
- #include <algorithm>
- #include <set>
- #include <iterator>
- #include <iomanip>
- #include <queue>
- #define pb push_back
- #define pop pop_back
- #define ff(element,start,end) for(auto element = start ; element < end ; element++)
- #define re return
- #define fi first
- #define se second
- #define sz(a) (int)a.size()
- using namespace std;
- typedef long long ll ;
- typedef long double ld;
- typedef vector<int> vi;
- typedef vector<long long> vll;
- typedef pair<int,int> pii;
- typedef string str;
- typedef set<int> si;
- typedef multiset<int> msi;
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0); cout.tie(0);
- int n,t[11];
- cin >> n;
- ff(i,0,n)
- cin >> t[i];
- ff(i,0,n)
- {
- if(t[i] % 10 >= 2 && t[i] % 10 <= 8)
- cout << "Yes\n";
- else
- {
- 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)
- cout << "Yes\n";
- else
- cout << "No\n";
- }
- }
- re 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement