题解 | #称砝码#
称砝码
http://www.nowcoder.com/practice/f9a4c19050fc477e9e27eb75f3bfd49c
num = int(input())
weight_list = []
wight = input().split(' ')
count = input().split(' ')
for i in range(num):
for j in range(int(count[i])):
weight_list.append(int(wight[i]))
total_weight = {0}
for i in weight_list:
for j in list(total_weight):
total_weight.add(i+j)
print(len(total_weight))
查看4道真题和解析