您的位置:首页 > 其它

hdu 1029 Ignatius and the Princess IV

2015-06-01 21:15 323 查看
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1029

简单题,stl水之。。

[code]#include<algorithm>
#include<cstdio>
#include<map>
using std::map;
map<int,int> rec;
int main() {
    int n, v, res, cnt;
    while (~scanf("%d", &n)) {
        res = cnt = 0;
        for (int i = 0; i < n; i++) {
            scanf("%d", &v);
            rec[v]++;
            if (rec[v] > cnt) cnt = rec[v], res = v;
        }
        printf("%d\n", res);
        rec.clear();
    }
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: