This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, a[N];
int main() {
ios:: sync_with_stdio(0), cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
for (int w = 1; w <= 100000; w++) {
int cnt = w;
bool mark = true;
for (int i = 0; i < n; i++) {
if (i) cnt++;
bool flag = false;
string s = to_string(cnt);
for (auto e : s)
if (e == char(a[i] + '0')) flag = true;
if (!flag) {
mark = false;
break;
}
}
if (mark) {
cout << w << '\n';
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... |