답안 #118521

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118521 2019-06-19T07:16:50 Z 송준혁(#2902) 수열 (BOI14_sequence) C++14
0 / 100
1000 ms 412 KB
#include <bits/stdc++.h>
using namespace std;

int N, ans=1;
int A[101010];

bool chk(int x, int d){
    if (!x) return false;
    if (x%10 == d) return true;
    return chk(x/10, d);
}

int main(){
    scanf("%d", &N);
    for (int i=1; i<=N; i++) scanf("%d", &A[i]);
    while (1){
        ans++;
        bool tf=true;
        for (int i=1; i<=N; i++){
            if (!chk(ans+i-1, A[i])){
                tf = false;
                break;
            }
        }
        if (tf) break;
    }
    printf("%d\n", ans);
    return 0;
}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
sequence.cpp:15:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (int i=1; i<=N; i++) scanf("%d", &A[i]);
                              ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 46 ms 412 KB Output is correct
3 Execution timed out 1073 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -