简要题意:
构造一个长为 (n) 的数,使得每位均不为 $0$,且 (n) 不被它的各位数字整除。
比方说, (n = 239) 是合法的。因为:
$2 ot | 239$,$3 ot | 239$,$9 ot | 239$.
再比方,(n = 235) 是不合法的。因为:
$5 | 235$.
因此,本题是个水构造。
首先 (n = 1),显然无解。
否则,考虑以下构造:
$$233 cdots 33$$
$$499 cdots 99$$
$$277 cdots 77$$
$$577 cdots 77$$
$$599 cdots 99$$
$$899 cdots 99$$
$$677 cdots 77$$
(cdots)
(盲猜不下 $1000$ 种构造,全部合法)
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
inline int read(){char ch=getchar();int f=1;while(ch<'0' || ch>'9') {if(ch=='-') f=-f; ch=getchar();}
int x=0;while(ch>='0' && ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();return x*f;}
int main(){
int T=read(); while(T--) {
int n=read();
if(n==1) printf("-1
");
else {
putchar('4');
for(int i=1;i<n;i++) putchar('9');
putchar('
');
} //499...99
}
return 0;
}