题解 | #合并表记录#
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n = int(input()) dic = {} for i in range(n): line = str(input()) line2 = line.split() key = int(line2[0]) value = int(line2[1]) dic[key] = dic.get(key, 0) + value for each in sorted(dic): print(each, dic[each])