HJ8 合并表记录
#include <iostream>
#include <map>
using namespace std;
int main() {
int size;
map<int, int> myMap;
cin>>size;
int index , value;
for(int i=0 ; i<size ; i++)
{
cin>>index>>value;
myMap[index] += value;
}
for(auto it:myMap)
{
cout<<it.first<<' '<<it.second<<endl;
}
}
// 64 位输出请用 printf("%lld")