AC代码:
#include <iostream> #include <cstdio> #include <map>; using namespace std; int main(void) { freopen("in.txt","r",stdin); map<long , long> vi; int m,n; scanf("%d%d",&m,&n); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ long tmp; scanf("%ld",&tmp); if(vi.find(tmp)!=vi.end()) vi[tmp]++; else vi[tmp]=1; } } map<long, long>::iterator it=vi.begin(); long max=0; int k=0; for(it;it!=vi.end();it++){ if(it->second > max){ max=it->second; k=it->first; } } printf("%d ",k); fclose(stdin); return 0; }