题解 | #合并表记录#
合并表记录
http://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n, a = [], {}
while True:
try:
n.append(tuple(input().split(' ')))
except:
break
n.pop(0)
n = sorted(n, key=lambda x:int(x[0]))
for i in n:
a[i[0]] = 0
for i in n:
a[i[0]] += int(i[1])
for k, v in a.items():
print(k, v)