合并表记录——python3解法
合并表记录
http://www.nowcoder.com/questionTerminal/de044e89123f4a7482bd2b214a685201
n = int(input()) dic = {} for i in range(n): line = input().split() key = int(line[0]) value = int(line[1]) dic[key] = dic.get(key,0)+value for each in dic: print(each, dic[each])