题解 | #合并表记录#
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n = int(input()) dic = {} for _ in range(0,n): k,v = map(int,input().split()) if k not in dic: dic[k] = v else: dic[k] = dic.get(k,0) + v ls = sorted(dic.items()) for k,v in ls: print(k,v)