#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
vector<int> bs(k);
for (int i = 0; i < k; i++)
cin >> bs[i];
int start = 1;
while (1) {
bool startgood = true;
for (int off = 0; off < k; off++) {
int val = start + off;
bool good = false;
while (val > 0) {
if (val % 10 == bs[off]) {
good = true;
break;
}
val /= 10;
}
if (!good) {
startgood = false;
break;
}
}
if (startgood) {
cout << start << endl;
return 0;
}
start++;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |