A. Bad Ugly Numbers
题意:
给你一个数
n
n
n,输出任意一个
n
n
n 位不包含0且不被它本身的任何一位整除的正整数,不存在输出
−
1
-1
−1。
思路:
n
=
1
n=1
n=1时输出
−
1
-1
−1,否则,构造
n
n
n 位数,
2333
⋅
⋅
⋅
3
2333···3
2333⋅⋅⋅3 或
5777
⋅
⋅
⋅
7
5777···7
5777⋅⋅⋅7 或
8999
⋅
⋅
⋅
9
8999···9
8999⋅⋅⋅9(大佬们的想法总是看不懂🙄)。
Code:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int T, n;
cin >> T;
while (T--)
{
cin >> n;
if (n == 1)
cout << -1 << endl;
else
cout << 2 << string(n - 1, '3') << endl;
// cout << 5 << string(n - 1, '7') << endl;
// cout << 8 << string(n - 1, '9') << endl;
}
return 0;
}