题解 | #合并表记录# python3
合并表记录
http://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n = int(input()) dic = dict() for _ in range(n): index, val = [int(each) for each in input().split()] if index not in dic: dic[index] = val else: dic[index] += val for i in sorted(dic): print('%d %d'%(i,dic[i]))