题解 | #合并表记录#
合并表记录
https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
def merge_records(n): records = {} for _ in range(n): index, value = map(int, input().split()) if index in records: records[index] += value else: records[index] = value for index in sorted(records.keys()): print(index, records[index]) n = int(input()) merge_records(n)