Codeforces Global Round 7

https://codeforces.com/contest/1326

 构造题:t组样例,每组一个n,求s,满足s > 0 && s有n位 && s每一位都不为0 &&s不能被其每一位整除

一看好多好头大啊,

n 是105    

早就超出longlong范围了,难道是bfs,然后判断一下,是否符合题意,但是原题给的也早超出了

这给怎么解呢??

第一个题一般不会太复杂

899999999.......9就解决了

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int t,n;
 4 int main(){
 5     //freopen("in","r",stdin);
 6     ios::sync_with_stdio(0);
 7     cin >> t;
 8     while(t--){
 9         cin >> n;
10         if(n == 1) cout << "-1";
11         else{
12             cout << "8";
13             for(int i = 1; i < n; i++)
14                 cout << "9";
15         }
16         cout << endl;
17     }
18     return 0;
19 }
View Code

猜你喜欢

转载自www.cnblogs.com/xcfxcf/p/12529743.html
今日推荐