标签:
典型MAP排序
#include"iostream" #include"map" using namespace std; map<int,int> m; int main(){ int n; cin>>n; int i; m.clear(); while(n--){ cin>>i; if(m[i]==0)m[i]=1; else m[i]++; } int num=0,count=0; map<int,int>::iterator it; for(it=m.begin();it!=m.end();it++){ if(it->second>count){ num=it->first; count=it->second; } } cout<<num<<endl; }
标签:
原文地址:http://www.cnblogs.com/lyqatdl/p/4726968.html