#include <bits/stdc++.h>
using namespace std;
int k;
int a[10000];
bool check(int x, int y) {
if(x == 0) return (x == y);
while(x > 0) {
if(x%10 == y) return 1;
x /= 10;
}
return 0;
}
int main() {
cin >> k;
for(int i = 1; i <= k; i++)
cin >> a[i];
for(int i = 1; i <= 1000; i++) {
bool ind = 1;
for(int j = 1; j <= k; j++){
if(!check(i+j-1,a[j])) ind = 0;
}
if(ind){
cout << i; return 0;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2052 KB |
Output is correct |
2 |
Correct |
3 ms |
2052 KB |
Output is correct |
3 |
Correct |
0 ms |
2052 KB |
Output is correct |
4 |
Correct |
0 ms |
2052 KB |
Output is correct |
5 |
Correct |
0 ms |
2052 KB |
Output is correct |
6 |
Correct |
0 ms |
2052 KB |
Output is correct |
7 |
Correct |
0 ms |
2052 KB |
Output is correct |
8 |
Correct |
13 ms |
2052 KB |
Output is correct |
9 |
Correct |
0 ms |
2052 KB |
Output is correct |
10 |
Correct |
0 ms |
2052 KB |
Output is correct |
11 |
Correct |
0 ms |
2052 KB |
Output is correct |
12 |
Correct |
0 ms |
2052 KB |
Output is correct |
13 |
Correct |
0 ms |
2052 KB |
Output is correct |
14 |
Correct |
16 ms |
2052 KB |
Output is correct |
15 |
Correct |
16 ms |
2052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2052 KB |
Output is correct |
2 |
Correct |
3 ms |
2052 KB |
Output is correct |
3 |
Correct |
0 ms |
2052 KB |
Output is correct |
4 |
Correct |
3 ms |
2052 KB |
Output is correct |
5 |
Correct |
0 ms |
2052 KB |
Output is correct |
6 |
Correct |
0 ms |
2052 KB |
Output is correct |
7 |
Incorrect |
9 ms |
2052 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2052 KB |
Output is correct |
2 |
Incorrect |
0 ms |
2052 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2052 KB |
Output is correct |
2 |
Correct |
6 ms |
2052 KB |
Output is correct |
3 |
Correct |
0 ms |
2052 KB |
Output is correct |
4 |
Correct |
0 ms |
2052 KB |
Output is correct |
5 |
Incorrect |
0 ms |
2052 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |