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>
#define rp(a,b) for(i=b;i--;)putchar(a)
int m[8]={0,9,10,3,12,5,6,15};
void t(){
int x,i,j;
scanf("%d",&x),j=m[x%8];
if(x<j)puts("-1");
else{
if(x>=20&&x%8==4)j=20;
if(j%5)rp('3',j/3);
else rp('5',j/5);
rp('8',(x-j)/8);puts("");
}
}
int main(){
int n;
for(scanf("%d",&n);n--;)t();
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... |