//map在主函数中定义
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<iostream>
#include<string>
using namespace std;
int main()
{
int printnum;
int m,n,c;
map<int,int>count;
scanf("%d%d",&m,&n);
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
scanf("%d",&c);
if(count.find(c)!=count.end()) count[c]++;
else count[c]=1;
}
}
int max=0;
for(map<int,int>::iterator it=count.begin();it!=count.end();it++)
{
if(it->second>max)
{
printnum=it->first;
max=it->second;
}
}
printf("%d\n",printnum);
system("pause");
return 0;
}
PAT 1054
最新推荐文章于 2019-08-25 11:52:15 发布