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 <cstdio>
int tmp[10];
int main()
{
for(int i=0;i<8;++i){
tmp[i]=i;
while(tmp[i]%3 && tmp[i]%5) tmp[i]+=8;
}
int t;
scanf("%d",&t);
for(;t--;){
int n;
scanf("%d",&n);
int a=tmp[n&7];
if(n<a){
puts("-1"); continue;
}
if(a==12 && n>=20) a=20;
n-=a;
if(a%5 == 0) for(;a;a-=5) putchar('5');
else for(;a;a-=3) putchar('3');
for(;n;n-=8) putchar('8');
putchar(10);
}
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... |