简介

简单

code

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    
    int k, v;
    map<int, int> m;
    for(int i = 0; i<n; i++){
        cin >> k >> v;
        m[k] += v;
    }
    for(auto it : m){
        cout << it.first << " " << it.second << endl;
    }
    return 0;
}
posted on 2021-06-22 18:44  HDU李少帅  阅读(44)  评论(0编辑  收藏  举报