题解 | #称砝码#
称砝码
https://www.nowcoder.com/practice/f9a4c19050fc477e9e27eb75f3bfd49c
while True: try: n=int(input()) weights=list(map(int,input().split())) nums=list(map(int,input().split())) res={0} for i,w in enumerate(weights): for j in range(nums[i]): # 每个砝码循环添加其数量次 for r in list(res): res.add(r + w) print(len(res)) except: break