이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
int K;
cin >> K;
vector<int> B(K);
for (int &v : B) {
cin >> v;
}
for (int N = 1; N <= 1000; N++) {
bool Good = true;
for (int i = 0; i < K; i++) {
int tmp = N + i;
bool good = false;
while (tmp > 0) {
if (tmp % 10 == B[i]) {
good = true;
}
tmp /= 10;
}
if (!good) {
Good = false;
}
}
if (Good) {
cout << N << "\n";
exit(0);
}
}
for (int x = 1; x <= 1000000; x *= 10) {
for (int y = 1; y <= 10; y++) {
int N = x * y;
bool Good = true;
for (int i = 0; i < K; i++) {
int tmp = N + i;
bool good = false;
while (tmp > 0) {
if (tmp % 10 == B[i]) {
good = true;
}
tmp /= 10;
}
if (!good) {
Good = false;
}
}
if (Good) {
cout << N << "\n";
exit(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... |