Submission #2324

# Submission time Handle Problem Language Result Execution time Memory
2324 2013-07-21T02:38:23 Z pull601 생일수 I (GA4_birthday1) C++
0 / 100
681 ms 4792 KB
#include <stdio.h>

#include <stdlib.h>

int d[1000001],f[9];

int main()

{

    int n,m,i,j,kk;

    d[3]=1; d[0]=1; d[5]=1; d[8]=1;

    scanf("%d",&n);

    for(i=1;i<=n;i++){

        scanf("%d",&m);

        kk=m;

        for(j=1;j<=m;j++){

            if(d[j-3]==1||d[j-5]==1||d[j-8]==1) d[j]=1;

            else continue;

        }

        if(d[m]==0){printf("%d",-1); continue;}

        while(1){

            if(d[kk-8]==1){f[8]+=1; kk=kk-8; }

            else if(d[kk-5]==1){ f[5]+=1; kk=kk-5;}

            else if(d[kk-3]==1){f[3]+=1; kk=kk-3;}

            if(kk==0) break;

        }

        for(j=1;j<=f[3];j++)printf("%d",3);

        for(j=1;j<=f[5];j++)printf("%d",5);

        for(j=1;j<=f[8];j++)printf("%d",8);

        printf("\n");

        f[3]=0; f[8]=0;f[5]=0;

    }

    return 0;

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4792 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4792 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 681 ms 4792 KB Output isn't correct
2 Halted 0 ms 0 KB -