#include <iostream>
#include <map>
using namespace std;
int main()
{
map<int, int> m;
int n, key, v;
cin >> n;
for (int i = 0; i < n; i++)
{
pair<int, int> data;
cin >> data.first;
cin >> data.second;
if ((m.find(data.first)) != m.end())
m[data.first] += data.second;
else
m[data.first] = data.second;
}
for (map<int, int>::iterator it = m.begin(); it != m.end(); it++)
{
cout << it->first << " " << it->second << endl;
}
return 0;
}
04-07
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)