#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;
}
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 |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |