hdu-1029-Ignatius and the Princess IV

题目链接

 1 /*
 2     Name:hdu-1029-Ignatius and the Princess IV
 3     Copyright:
 4     Author:
 5     Date: 2018/4/25 10:26:16
 6     Description:
 7     water,water
 8 */
 9 #include <iostream>
10 #include <cstdio>
11 #include <map>
12 #include <algorithm>
13 #include <utility>
14 using namespace std;
15 map<int ,int> capt;
16 bool cmp (pair<int, int> a, pair<int, int> b) {
17     return a.first < b.second;
18 }
19 int main()
20 {
21 //    freopen("in.txt", "r", stdin);
22     int n;
23     while (~scanf("%d", &n)) {
24         capt.clear();
25         while (n--) {
26             int tmp;
27             scanf("%d", &tmp);
28             capt[tmp]++;
29         }
30         printf("%d
", max_element(capt.begin(), capt.end(), cmp)->first);
31     }
32     return 0;
33 }
原文地址:https://www.cnblogs.com/slothrbk/p/8940711.html