-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathluckyno.cpp
More file actions
executable file
·36 lines (34 loc) · 903 Bytes
/
luckyno.cpp
File metadata and controls
executable file
·36 lines (34 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL)
#define endl '\n'
#define int long long int
using namespace std;
#define pii pair <int, int>
#define pb push_back
#define loop(s, e, itr) for (int itr = s; itr < e; itr++)
#define vin vector<int>
#define w(t) int tc; cin >> tc; for(int t = 1; t <= tc; t++)
vin get_arr(int n){
vin arr;
while(n){
arr.pb(n%10);
n/=10;
}
return arr;
}
int32_t main(){
fastio;
int n;
w(t){
cin >> n;
vin arr = get_arr(n);
sort(arr.begin(), arr.end());
bool flag = false;
int len = arr.size();
for(int i = 1; i < len; i++){
if(arr[i] - arr[i-1] > 2){flag = true; break;}
}
if(flag) cout << "NO" << endl;
else cout << "YES" << endl;
}
}