ZOj 2104——Let the Balloon Rise
来源:互联网 发布:清华 软件硕士 编辑:程序博客网 时间:2024/05/16 12:37
老师在上课的时候讲过这道题,不过当时做这道题时还是纠结了许久,那时stl不熟,老是想着用数组,去重很麻烦,学了STL后,用map就简单多了。
code :
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main() {
map < string, int >m;
string a, k;
int n, max;
while (cin >> n && n) {
m.clear();
while (n--) {
cin >> a;
m[a]++;
}
map < string, int >::iterator it;
max = 0;
for (it = m.begin(); it != m.end(); it++) {
if ((*it).second > max) //遍历寻找最大的气球数{
max = (*it).second;
k = (*it).first;
}
}
cout << k << endl;
}
return 0;
}
0 0
- ZOj 2104——Let the Balloon Rise
- zoj 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- zoj 2104 Let the Balloon Rise
- ZOJ 2104Let the Balloon Rise
- hdu1004——Let the Balloon Rise
- HDU1004——Let the Balloon Rise
- hdu1004——Let the Balloon Rise
- ZOJ2104——Let the Balloon Rise
- HDU1004——Let the Balloon Rise
- hdu1004——Let the Balloon Rise
- 1004—Let the Balloon Rise
- Let the Balloon Rise—STL(map)
- HDU 1004 — Let the Balloon Rise
- HDU-1004—Let the Balloon Rise
- hdu1004—Let the Balloon Rise
- C++中几种将整数转换成二进制输出的方法
- 快速pow和sqrt的小技巧 hdu4282
- pow(x,y)函数
- ZOJ 2060----Fibonacci Again
- ZOJ 1295——Reverse Text
- ZOj 2104——Let the Balloon Rise
- Zoj 2947——Abbreviation
- ZOJ 1151——Word Reversal
- 总结:创建maven项目时可能会出现的问题
- 【转载】输出二进制 C
- #define和const的区别
- 【转载】define与typedef区别与联系
- C语言整理-7
- java在acm中的一些应用