Python题解 | #合并表记录#
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
while True:
try:
a = {}
b = int(input())
c = set()
for _ in range(b):
st1 = input().split(" ")
x = int(st1[0])
y = int(st1[1])
if x not in c:
c.add(x)
a[x] = y
else:
a[x] = a[x] + y
res = sorted(a.keys(), reverse=False)
for i in res:
print(i, a[i])
except:
break

海康威视公司福利 1330人发布