题解 | #合并表记录#

合并表记录

http://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201

while True:
    try:
        n = int(input())
        dic = {}
        while n > 0:
            index,value = map(int,input().split(' '))
            if index in dic:
                dic[index] += value
            else:
                dic[index] = value
            n -= 1
        for i in sorted(dic):
            print(i,dic[i])
    except:
        break
            
            
全部评论

相关推荐

找到实习就改名4月17日下午更改:这个在牛客不是老熟人了吗
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务