Papyrus在审判你 • 4个月前
#include <bits/stdc++.h>
using namespace std;
int a[20001] = {0};
int r[14] = {0, 0, 1, 7, 4, 2, 6, 8, 10, 18, 22, 20, 28, 68};
int main() {
int n;
cin >> n;
while (n--) {
memset(a, 0, sizeof(0));
int x = 0;
cin >> x;
if (x < 2) {
cout << "-1" << endl;
continue;
}
int w = 0;
while (1 > 0) {
if (x == 0) {
break;
}
if (x < 14) {
if (x == 10 && w > 0) {
a[w] = r[11];
a[w - 1] = 0;
break;
}
a[w] = r[x];
break;
}
x = x - 7;
a[w] = 8;
w++;
}
for (int i = w; i >= 0; i--) {
cout << a[i];
}
cout << endl;
}
return 0;
}
评论:
请先登录,才能进行评论