题解 | #合并表记录#
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n = int(input()) # 输入键值对的个数
dic = {} # 创建一个空字典
for i in range(0,n):
line = input().strip().split()
key = int(line[0])
value = int(line[1])
dic[key] = dic.get(key,0) + value
for each in sorted(dic):
print(each,dic[each])


