题解 | 灵异背包?

灵异背包?

https://www.nowcoder.com/practice/812bcedbbe244c9b86e459a244af5ddf

n = int(input())
a = list(map(int,input().split()))
s = sum(a)#先计算数组的和
if s%2==1:#如果数组的和为奇数,则删除当前数组中最小的奇数
    for c in sorted(a):
        if c%2==1:
            s -= c
            break
print(s)

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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