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<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{
int n, i, j, c, v, b, na, a;
cin >> n;
for(i=1;i<=n;i++){
na=0;
cin >> a;
c=a/8;
na=a%8;
v=na/5;
na=na%5;
b=na/3;
na=na%3;
if(na>=1){
if(a%8==0){
for(j=1;j<=a/8;j++)cout << "8";
cout << endl;
}
if(a%5==0){
for(j=1;j<=a/5;j++)cout << "5";
cout << endl;
}
if(a%3==0){
for(j=1;j<=a/3;j++)cout << "3";
cout << endl;
}
else cout << "-1" << endl;
}
else{
for(j=1;j<=b;j++)cout << "3";
for(j=1;j<=v;j++)cout << "5";
for(j=1;j<=c;j++)cout << "8";
cout << endl;
}
}
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... |