https://codeforces.com/contest/1770/attachments/download/18470/editorial.pdf
这个pdf都写得很明白了,这个c题终于懂了,麻了à$a_i^j \leq b^j$
本来只需要枚举n/2之内的质数,但是因为n很小,所以直接枚举n/2也可以
#include<bits/stdc++.h> #define debug1(a) cout<<#a<<'='<< a << endl; #define debug2(a,b) cout<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<endl; #define debug3(a,b,c) cout<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<" "<<#c<<" = "<<c<<endl; #define debug4(a,b,c,d) cout<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<" "<<#c<<" = "<<c<<" "<<#d<<" = "<<d<<endl; #define debug5(a,b,c,d,e) cout<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<" "<<#c<<" = "<<c<<" "<<#d<<" = "<<d<<" "<<#e<<" = "<<e<<endl; #define debug0(x) cout << "debug0: " << x << endl #define fr(t, i, n)for (long long i = t; i < n; i++) #define YES cout<<"Yes"<<endl #define nO cout<<"no"<<endl #define fi first #define se second #define int long long using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int,int> PII; typedef pair<LL,LL> PLL; //#pragma GCC optimize(3,"Ofast","inline") //#pragma GCC optimize(2) const int N = 110; int a[N]; bool solve() { int n;cin >> n; for(int i = 0;i < n;i ++)cin >> a[i]; sort(a,a+n); for(int i = 1;i < n;i ++) if(a[i] == a[i-1]) { return 0; } bool acc = 1; for(int i = 2;i <= n;i ++) { vector<int> num(i,0); for(int j = 0;j < n;j ++)num[a[j] % i]++; if(*min_element(num.begin(),num.end()) >= 2)acc = 0; } return acc; } signed main() { /* ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); */ int T = 1;cin >> T; while(T--){ puts(solve()?"YES":"NO"); } return 0; } /* */
标签:codeforces,Theory,contest,int,cin,Number,++,num From: https://www.cnblogs.com/cfddfc/p/17019230.html