题解 | #称砝码#
称砝码
http://www.nowcoder.com/practice/f9a4c19050fc477e9e27eb75f3bfd49c
集合
# 输入
n = int(input())
weight = list(map(int,input().split()))
weightNum = list(map(int,input().split()))
# 整合
arr = []
for i in range(n):
for j in range(weightNum[i]):
arr.append(weight[i])
# 所有组合情况
res = {0}
for i in arr:
for j in list(res):
# 集合去重
res.add(i+j)
print(len(res))