题解 | #合并表记录#
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
#include <cstddef>
#include <iostream>
#include <map>
using namespace std;
int main() {
size_t cnt;
cin >> cnt;
size_t key;
size_t value;
map<size_t, size_t> my_map;
for(size_t i = 0; i < cnt; ++i){
cin >> key >> value;
my_map[key] += value;
}
for(auto iter : my_map){
cout << iter.first << " " << iter.second << endl;
}
return 0;
}
// 64 位输出请用 printf("%lld")

