#include <bits/stdc++.h>
using namespace std;
int n,arr[100001];
int ok(int a , int b){
while(a){
if(a%10 == b){
return true;
}
a /= 10;
}
return false;
}
bool ok2(int val){
int num = val;
for(int i = 0 ; i < n ; i += 1){
if(!ok(num,arr[i])){
return 0;
}
num += 1;
}
return 1;
}
int main(){
cin >> n;
for(int i = 0 ; i < n ; i += 1){
cin >> arr[i];
}
int val = max(arr[0],1);
while(true){
if(arr[0] == 9){
int v2 = 0 , vv = val;
while(vv){
v2 = (10*v2+8);
vv /= 10;
}
v2 += 1;
if(ok2(v2)){
cout << v2 << endl;
return 0;
}
}
if(ok2(val)){
cout << val << endl;
return 0;
}
val *= 10;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
3 ms |
332 KB |
Output is correct |
3 |
Correct |
4 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
332 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
12 ms |
588 KB |
Output is correct |
8 |
Correct |
8 ms |
460 KB |
Output is correct |
9 |
Correct |
19 ms |
844 KB |
Output is correct |
10 |
Correct |
18 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |