답안 #755204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755204 2023-06-09T14:58:13 Z AliHasanli 수열 (BOI14_sequence) C++17
9 / 100
6 ms 596 KB
#include<bits/stdc++.h>
using namespace std;
bool check_is_number_has(long long n,long long a)
{
    while(n>0)
    {
        if(n%10==a)
            return true;
        n/=10;
    }
    return false;
}
bool check(long long a,int k,long long numberarray[])
{
    for(long long i=a;i<=k+a-1;i++)
        if(!check_is_number_has(i,numberarray[i-a]))
            return false;
    return true;
}
void print(int n,int k)
{
    cout<<n;
    exit(0);
}
int main (){
    int k;
    cin>>k;
    long long a[k];
    long long digits0[19],digits1[19],digits2[19];
    digits0[0]=1;
    digits1[0]=a[0];
    digits2[0]=9;
    for(int i=1;i<19;i++)
        digits0[i]=digits0[i-1]*10;
    for(int i=1;i<19;i++)
        digits1[i]=digits1[i-1]*10;
    for(int i=1;i<19;i++)
        digits2[i]=(digits2[i-1]-1)*10+9;
    bool areequal=true;
    for(int i=0;i<k;i++)
    {
        cin>>a[i];
        if(i>0 && a[i]!=a[i-1])
            areequal=false;
    }
    if(areequal)
    {
        if(a[0]==0)
            for(int i=0;i<=18;i++)
                if(check(digits0[i],k,a))
                    print(digits0[i],k);
        if(a[0]>=1 && a[0]<=8)
            for(int i=0;i<=18;i++)
                if(check(digits1[i],k,a))
                    print(digits1[i],k);
        if(a[0]==9)
            for(int i=0;i<=18;i++)
                if(check(digits2[i],k,a))
                    print(digits2[i],k);
    }
    for(long long i=a[0];i<=1000;i++)
    {
        bool flag=check(i,k,a);
        if(flag)
            print(i,k);
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 248 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Incorrect 2 ms 340 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 6 ms 596 KB Output isn't correct
6 Halted 0 ms 0 KB -