답안 #418964

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418964 2021-06-06T09:20:53 Z VladM 수열 (BOI14_sequence) C++14
9 / 100
1 ms 252 KB
#include <bits/stdc++.h>

using namespace std;

long long n, k, b[1007], flag, totflag, c, it;

vector<long long> vec;

void get_char(long long a)
{
    vec.clear();
    while(a>0)
    {
        vec.push_back(a%10);
        a/=10;
    }
    return;
}

int main()
{
    cin>>k;
    for(int i=1; i<=k; i++) cin>>b[i];
    for(int n=1; n<=1000; n++)
    {
        totflag=0;
        for(int i=1; i<=k; i++)
        {
            c=n+i-1;
            get_char(c);
            flag=0;
            for(int j=0; j<vec.size(); j++)
            {
                if(vec[j]==b[i]) flag=1;
            }
            if(flag==0)
            {
                totflag=1;
                break;
            }
        }
        if(totflag==0)
        {
            cout<<n<<endl;
            return 0;
        }
    }
    it=b[1];
    if(it==0) it=10;
    for(int s=1; s<=15; s++)
    {
        totflag=0;
        for(int i=1; i<=k; i++)
        {
            c=it+i-1;
            get_char(c);
            flag=0;
            for(int j=0; j<vec.size(); j++)
            {
                if(vec[j]==b[i]) flag=1;
            }
            if(flag==0)
            {
                totflag=1;
                break;
            }
        }
        it*=10;
        if(totflag==0)
        {
            cout<<it<<endl;
            return 0;
        }
    }
    return 0;
}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:32:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for(int j=0; j<vec.size(); j++)
      |                          ~^~~~~~~~~~~
sequence.cpp:58:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |             for(int j=0; j<vec.size(); j++)
      |                          ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 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 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 252 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Incorrect 1 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 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -