题解 | #合并表记录#
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n = int(input()) a = {} for i in range(n): b,c = map(int,input().split()) a[b] = a.get(b,0)+c for j in sorted(a): print(j,a[j])
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n = int(input()) a = {} for i in range(n): b,c = map(int,input().split()) a[b] = a.get(b,0)+c for j in sorted(a): print(j,a[j])
相关推荐