| 记录编号 | 609026 | 评测结果 | AAAAAAAAAA | 
    
        | 题目名称 | 4051.[CSP 2024 J]小木棍 | 最终得分 | 100 | 
    
        | 用户昵称 |  Anzio | 是否通过 | 通过 | 
    
        | 代码语言 | C++ | 运行时间 | 0.165 s | 
    
        | 提交时间 | 2025-10-31 11:30:42 | 内存使用 | 3.65 MiB | 
    
    
    
    		显示代码纯文本
		
		#include<bits/stdc++.h>
using namespace std;
int main() {
	freopen("sticks.in","r",stdin);
	freopen("sticks.out","w",stdout);
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		// 当木棍不足两个时显然没法拼成数
		if (n < 2) {
			cout << -1 << endl;
			continue;
		}
		// 7的倍数:全拼成8
		if (n % 7 == 0) {
			for (int i = 0; i < n / 7 ; i++)
				cout << 8;
			cout << endl;
		}
		// 余1:最高位1,第二位零,剩下全8
		if (n % 7 == 1) {
			cout << "10";
			for (int i = 0 ; i < n / 7 - 1 ; i ++)
				cout << 8;
			cout << endl;
		}
		// 余2:最高位1剩下全8
		if (n % 7 == 2) {
			cout << 1;
			for (int i = 0 ; i < n / 7 ; i++)
				cout << 8;
			cout << endl;
		}
		// 余3:前三位200剩下全8。特判:如果只有3就输出个7,10输出22
		if (n % 7 == 3) {
			if (n == 3) {
				cout << 7 << endl;
				continue;
			}
			if (n == 10) {
				cout << 22 << endl;
				continue;
			}
			cout << "200";
			for (int i = 0 ; i < n / 7 - 2; i++)
				cout << 8;
			cout << endl;
		}
		// 余4:前两位20剩下全8。特判:只有4输出4
		if (n % 7 == 4) {
			if (n == 4) {
				cout << 4 << endl;
				continue;
			}
			cout << "20";
			for (int i = 0; i < n / 7 - 1; i++)
				cout << 8;
			cout << endl;
		}
		// 余5:最高位2剩下一堆8
		if (n % 7 == 5) {
			cout << 2;
			for (int i = 0 ; i < n / 7 ; i ++)
				cout << 8;
			cout << endl;
		}
		// 余6:第一位6,剩下是8。
		if (n % 7 == 6) {
			cout << 6;
			for (int i = 0 ; i < n / 7 ; i ++)
				cout << 8;
			cout << endl;
		}
	}
	return 0;
}