#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
using namespace std;
int n,x,ans=1,cnt;
map<int,int>mp;
void dic(int x)
{
for(int i=2;i*i<=x;++i)
{
if(x%i==0)
{
mp[i]++;
while(x%i==0)x/=i;
}
}
if(x!=1)mp[x]++;
}
int main(void)
{
cin>>n;
for(int i=1;i<=n;++i)
{
cin>>x;
dic(x);
}
for(auto it=mp.begin();it!=mp.end();++it)
{
if(it->second>cnt)
{
cnt=it->second;
ans=it->first;
}
}
cout<<ans<<endl;
return 0;
}
map的遍历方法
最新推荐文章于 2024-07-01 16:13:53 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)