题解 | #合并表记录#
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n = eval(input()) d = {} for i in range(n): x1,x2 = input().strip().split(" ") d[x1]= eval(x2)+d.get(x1,0) output = sorted(d.items(),key=lambda x:eval(x[0]),reverse=False) for i in output: print(i[0],i[1])