题解 | 灵异背包?
灵异背包?
https://www.nowcoder.com/practice/812bcedbbe244c9b86e459a244af5ddf
import sys
n=int(input())
gh=list(map(int,input().split()))
we=sum(gh)
#如果总和为奇数说明序列至少含有一个奇数,排下序找到最小的那个删掉即可
gh.sort(reverse=False)
if we%2!=0:
for i in gh:
if i%2==1:
gh.remove(i)
break
print(sum(gh))
