#include<stdio.h>
int main()
{
int n, i, a, j;
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d", &a);
if(a%40!=20){
if(a%8 == 3 || a%8 == 5 || a%8 == 6 || a%8 == 0){
if(a%8 ==0){
for(j=1;j<=a/8;j++)printf("8");
printf("\n");
}else{
if(a%8!=6)printf("%d", a%8);
else printf("33");
for(j=1;j<=a/8;j++)printf("8");
printf("\n");
}
}else{
if(a<8){
printf("-1\n");
}else{
if(a%8==1)printf("333");
if(a%8==2)printf("55");
if(a%8==4)printf("3333");
if(a%8==7)printf("555");
for(j=2;j<=a/8;j++)printf("8");
printf("\n");
}
}
}else{
for(j=1;j<=a/5;j++)printf("5");
printf("\n");
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
72 ms |
884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |