https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards/
class Solution {
public:
int gcd(int x,int y) {return x?gcd(y%x,x):y;}
bool hasGroupsSizeX(vector<int>& deck){
int vis[10005]{0},ans;
for(int i=0;i<deck.size();++i){ //记录个数
vis[deck[i]]++;
}
ans=vis[deck[0]];
for(int i=0;i<deck.size();++i) ans=gcd(ans,vis[deck[i]]); //如果互质则错,ans返回1
return ans>=2;
}
};