# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
2329 |
2013-07-21T02:50:55 Z |
pull601 |
생일수 I (GA4_birthday1) |
C |
|
684 ms |
4692 KB |
#include <stdio.h>
#include <stdlib.h>
int d[1000001],f[9];
int main()
{
int n,m,i,j,kk,t=0,tt=0;
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;
}
t=f[3]/4;
if(t>0&&f[8]>0){ f[3]=f[3]-t*4;f[8]=f[8]-t; f[5]=f[5]+t*4;}
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);
f[3]=0; f[8]=0;f[5]=0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
4692 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
4692 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
4692 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
684 ms |
4692 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |