题解 | #整数与IP地址间的转换#

称砝码

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

n = int(input())
farmar_weight = input().split(' ')
count = input().split(' ')
weight_list = []
for i in range(n):
    for j in range(int(count[i])):
        weight_list.append(int(farmar_weight[i]))
total_weight = {0}
for i in weight_list:
    for j in list(total_weight):
        total_weight.add(i+j)
print(len(total_weight))
    
全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 18:02
点赞 评论 收藏
分享
06-02 15:17
门头沟学院 Java
心爱的idea:怎么会呢 应该是打招呼有问题 问就说实习6个月全国可飞随时到岗
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

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