답안 #422004

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422004 2021-06-09T14:40:30 Z HappyPacMan 수열 (BOI14_sequence) C++14
34 / 100
8 ms 892 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int K;
    cin >> K;
    int B[K];
    for(int i=0;i<K;i++){
        cin >> B[i];
    }
    if(K > 1000){
        if(B[0] == 0 || B[0] == 9){
            if(B[0] == 0) cout << "10";
            if(2 <= K && K <= 11) cout << (B[0] == 0 ? "0" : "8");
            else if(K <= 111) cout << (B[0] == 0 ? "00" : "88");
            else if(K <= 1111) cout << (B[0] == 0 ? "000" : "888");
            else if(K <= 11111) cout << (B[0] == 0 ? "0000" : "8888");
            else  cout << (B[0] == 0 ? "00000" : "88888");
            if(B[0] == 9) cout << "9";
            cout << '\n';
        }else{
            cout << B[0];
            if(2 <= K && K <= 10) cout << "0\n";
            else if(K <= 100) cout << "00\n";
            else if(K <= 1000) cout << "000\n";
            else if(K <= 10000) cout << "0000\n";
            else cout << "00000\n";
        }
        return 0;
    }
    for(int i=1;i<=1000;i++){
        int sum = 0;
        for(int j=0;j<K;j++){
            bool valid = false;
            int temp = i+j;
            while(temp > 0){
                if(temp % 10 == B[j]) valid = true;
                temp = temp / 10;
            }
            sum += valid;
        }
        if(sum == K){
            cout << i << '\n';
            return 0;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 312 KB Output is correct
8 Correct 7 ms 312 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 5 ms 204 KB Output is correct
15 Correct 6 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 5 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 1 ms 376 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 6 ms 716 KB Output is correct
8 Correct 4 ms 448 KB Output is correct
9 Correct 8 ms 892 KB Output is correct
10 Correct 8 ms 844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Incorrect 4 ms 460 KB Output isn't correct
6 Halted 0 ms 0 KB -