#include #include using namespace std; int main() { int n; cin >> n; //用数据结构unordered_map unordered_map _map; int c; for (int i = 0; i < n; i++) { cin >> c; _map[c]++; } //对value进行排序,tmp为结果(经典用法,板子) vector> tmp; for (auto &i : _map) tmp.push_back(i); sort(tmp.begin(), tmp.end(), [=](pair &a, pair &b) { return a.second < b.second; }); //输出最后一个元素的first即可 cout << tmp[tmp.size() - 1].first << endl; return 0; }