题解 | 灵异背包?
灵异背包?
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)
灵异背包?
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)
相关推荐