题目:https://pintia.cn/problem-sets/1268384564738605056/problems/1291317697694580736
题解:https://blog.csdn.net/qq_40946921/article/details/99723044
代码:
#include<iostream> #include<map> using namespace std; int main() { map<int, int> mp; int n, t; cin >> n; for (int i = 0; i < n; ++i) { cin >> t; mp[t]++; } for (auto& it : mp) cout << it.first << ":" << it.second << endl; return 0; }