题解 | #称砝码#
称砝码
https://www.nowcoder.com/practice/f9a4c19050fc477e9e27eb75f3bfd49c
while True:
try:
n = int(input())
m = map(int,input().split())
x = map(int,input().split())
weight = {0}
for mi,xi in zip(m,x):
for i in range(xi):
weight |= set([mi+s for s in weight])
print(len(weight))
except:
break
# while 1:
# try:
# n = int(input())
# m = map(int, input().split())
# x = map(int, input().split())
# weights = {0}
# for xi, mi in zip(x, m):
# for i in range(xi): # xi 表示有几个
# weights |= set([s+mi for s in weights]) # n个玛法,一个个加入set里面
# print(len(weights))
# except:
# break
