This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
int main()
{
int T,N,n3,n5,n8,i,j;
scanf("%d",&T);
for(i=0;i<T;i++)
{
n3=0;
n5=0;
n8=0;
scanf("%d",&N);
if(N==1||N==2||N==4||N==7)
{
printf("-1\n");
continue;
}
while(N>=8)
{
if(N==9||N==10||N==12||N==15||N==20)
break;
n8++;
N-=8;
}
while(N>=5)
{
if(N==6||N==9||N==12)
break;
n5++;
N-=5;
}
while(N>=3)
{
n3++;
N-=3;
}
for(j=0;j<n3;j++)
printf("3");
for(j=0;j<n5;j++)
printf("5");
for(j=0;j<n8;j++)
printf("8");
printf("\n");
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |