PAT_A1054

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\n",k);
    
    fclose(stdin);
    return 0;
}

 

posted @ 2019-03-01 20:18  pha创噬  阅读(238)  评论(0编辑  收藏  举报