题解 | #称砝码#

称砝码

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

n = int(input())
m = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

m_weights = []
for i in range(n):
    weights = []
    for j in range(x[i]):
        weights.append(m[i])
    m_weights.extend(weights)

types = {0}
for i in m_weights:
    types |= {j+i for j in types}

print(len(types))

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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