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>
int main()
{
int n, i, a, j;
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d", &a);
if(a%8 == 3 || a%8 == 5 || a%8 == 0){
if(a%8 ==0){
for(j=1;j<=a/8;j++)printf("8");
printf("\n");
}else{
printf("%d", a%8);
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==6)printf("3335");
if(a%8==7)printf("555");
for(j=2;j<=a/8;j++)printf("8");
printf("\n");
}
}
}
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... |