ZOJ 2104/HDU 1004 Let the Balloon Rise(map容器)
2013-03-09 18:19
471 查看
#include <iostream> #include <string> #include <map> using namespace std; int main() { map<string,int>m; string s; map<string,int>::iterator it,it2; int n; while(cin>>n&&n) { m.clear(); for(int i=0;i<n;i++) { cin>>s; //在映照容器中查找键值 if(m.find(s)!=m.end()) m[s]++; else m[s]=1; } it2=m.begin(); for(it=m.begin();it!=m.end();it++) { //注意,映照容器中,元素的键值为it->first //元素映照值为it->second if(it2->second<it->second) it2=it; } cout<<it2->first<<endl; } return 0; }
相关文章推荐
- map容器的应用:hdu 1004 Let the Balloon Rise
- zoj 2104 Let the Balloon Rise(map映照容器的应用)
- HDU - 1004 Let the Balloon Rise (map)
- HDU 1004 Let the Balloon Rise(Map)
- HDU 1004 Let The Balloon Rise (简单map)
- HDU 1004 Let the Balloon Rise(map)
- HDU 1004(map) Let the Balloon Rise
- HDU 1004 Let the Balloon Rise (map使用)
- HDU-1004 Let the Balloon Rise STL map
- 2104:Let the Balloon Rise——map容器
- HDU 1004 - Let the Balloon Rise(map 用法样例)
- HDU 1004 Let the Balloon Rise【Map】
- HDU-1004 Let the Balloon Rise(map)
- HDU-1004 Let the Balloon Rise(STL: map)
- 【map热手题】HDU 1004—Let the Balloon Rise
- HDU 1004 Let the Balloon Rise(map应用)
- HDU-#1004 Let the Balloon Rise(字符串+map)
- HDUOJ 1004 Let the Balloon Rise(map容器)
- HDU 1004 Let the Balloon Rise(map)
- HDU 1004 Let the Balloon Rise(map键值的运用)