题目: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;
}

 

 posted on 2020-09-05 22:35  邢涌芝  阅读(65)  评论(0编辑  收藏  举报