#include<stdio.h>
int a;
int tw[3]={0,2,1};
int us[3]={0};
int tt[2]={0};
int t;
int m;
int main(){
int i,j;
scanf("%d",&t);
for(i=0;i<t;i++){
scanf("%d",&a);
if(a==1||a==2||a==4||a==7) printf("-1\n");
else{
if(a==12) printf("3333\n");
else{
m=a%8;
switch(m){
case 0:
for(j=0;j<a/8;j++) printf("8");
break;
case 1:
printf("333");
for(j=0;j<(a-9)/8;j++) printf("8");
break;
case 2:
printf("55");
for(j=0;j<(a-10)/8;j++) printf("8");
break;
case 3:
printf("3");
for(j=0;j<(a-3)/8;j++) printf("8");
break;
case 4:
printf("5555");
for(j=0;j<(a-20)/8;j++) printf("8");
break;
case 5:
printf("5");
for(j=0;j<(a-5)/8;j++) printf("8");
break;
case 6:
printf("33");
for(j=0;j<(a-6)/8;j++) printf("8");
break;
case 7:
printf("555");
for(j=0;j<(a-15)/8;j++) printf("8");
break;
}
printf("\n");
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
2 |
Correct |
0 ms |
884 KB |
Output is correct |
3 |
Correct |
0 ms |
884 KB |
Output is correct |
4 |
Correct |
0 ms |
884 KB |
Output is correct |
5 |
Correct |
0 ms |
884 KB |
Output is correct |
6 |
Correct |
0 ms |
884 KB |
Output is correct |
7 |
Correct |
0 ms |
884 KB |
Output is correct |
8 |
Correct |
0 ms |
884 KB |
Output is correct |
9 |
Correct |
0 ms |
884 KB |
Output is correct |
10 |
Correct |
0 ms |
884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
70 ms |
884 KB |
Output is correct |
2 |
Correct |
69 ms |
884 KB |
Output is correct |
3 |
Correct |
83 ms |
884 KB |
Output is correct |
4 |
Correct |
66 ms |
884 KB |
Output is correct |
5 |
Correct |
68 ms |
884 KB |
Output is correct |
6 |
Correct |
76 ms |
884 KB |
Output is correct |
7 |
Correct |
78 ms |
884 KB |
Output is correct |
8 |
Correct |
81 ms |
884 KB |
Output is correct |
9 |
Correct |
89 ms |
884 KB |
Output is correct |
10 |
Correct |
77 ms |
884 KB |
Output is correct |
11 |
Correct |
66 ms |
884 KB |
Output is correct |
12 |
Correct |
73 ms |
884 KB |
Output is correct |
13 |
Correct |
78 ms |
884 KB |
Output is correct |
14 |
Correct |
83 ms |
884 KB |
Output is correct |
15 |
Correct |
73 ms |
884 KB |
Output is correct |
16 |
Correct |
76 ms |
884 KB |
Output is correct |
17 |
Correct |
80 ms |
884 KB |
Output is correct |
18 |
Correct |
78 ms |
884 KB |
Output is correct |
19 |
Correct |
72 ms |
884 KB |
Output is correct |
20 |
Correct |
74 ms |
884 KB |
Output is correct |
21 |
Correct |
73 ms |
884 KB |
Output is correct |
22 |
Correct |
85 ms |
884 KB |
Output is correct |
23 |
Correct |
74 ms |
884 KB |
Output is correct |
24 |
Correct |
72 ms |
884 KB |
Output is correct |
25 |
Correct |
75 ms |
884 KB |
Output is correct |