题解 | #称砝码#

称砝码

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

while True:
    try:
        n = int(input())
        mList = list(map(int, input().split()))
        xList = list(map(int, input().split()))
        lst = []
        for i in zip(mList, xList):
            lst += [i[0]] * i[1]
        weights = {0}
        for i in lst:
            for j in list(weights):
                weights.add(i+j)
        print(len(weights))
    except:
        break
全部评论

相关推荐

星辰再现:裁员给校招生腾地方
点赞 评论 收藏
分享
评论
16
3
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务