题解 | #合并表记录#
合并表记录
http://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
a = int(input())
names = []
values = []
for i in range(a):
x = input()
m, n = x.split()
if m in names:
values[names.index(m)] += int(n)
else:
names.append(m)
values.append(int(n))
newnames = list(map(int, names))
comb = zip(newnames,values)
mydict = dict(sorted(comb))
for i, j in mydict.items():
print(i, j)