#include<iostream> #include<map> #include<string> using namespace std; typedef map<string,int> MAP; int main(){ int n; string s; cin>>n; MAP map; while(n){ int max = 0; for(int i=0;i<n;i++){ cin>>s; ++map[s]; if(map[s]>max) max = map[s]; } for(MAP::iterator j = map.begin();j!=map.end();j++){ if(j->second == max) cout<<(*j).first<<endl; } map.clear(); cin>>n; } }
杭电1003 MAP 排序
最新推荐文章于 2020-12-20 02:14:02 发布
本文详细探讨了C++中Map数据结构的应用,包括如何使用Map进行数据存储、检索和更新,并通过实例展示了Map在实际编程场景中的高效性。
392

被折叠的 条评论
为什么被折叠?



