이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
bool indd = 1;
for(int i = 1; i <= k; i++) {
cin >> a[i];
if(i > 1 && a[i-1] != a[i]) indd = 0;
}
if(indd) {
int K, x, ans;
x = a[1];
K = k;
if(k == 1){
if(x == 0) cout << 10;
else
cout << x; return 0;
}
ans = 1;
while(k > 0){
k /= 10;
ans *= 10;
}
if(x != 0)
ans *= x;
else
ans *= 10;
int cnt = 0;
int pp = ans;
if(x == 9){
ans = 88; cnt = 11;
k =K;
while(cnt < k){
cnt *= 10; cnt++;
ans *= 10; ans += 8;
}
ans++;
}
ans = min(ans,pp);
cout << ans;
return 0;
}
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;
}
}
}
# | 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... |