题解 | #称砝码#

称砝码

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

集合的巧妙使用
N = int(input())
m = list(map(int,input().split()))
n = list(map(int,input().split()))
res = [0]
for i in range(N):
    s = [m[i] * j for j in range(n[i] + 1)]
    res = list(set(x+y for x in s for y in res))
print(len(res))


全部评论
取了0,有点妙
点赞 回复 分享
发布于 2023-09-26 20:41 广东

相关推荐

评论
8
3
分享

创作者周榜

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