完美 第一题。。。。为啥只能80%啊。。。。求教
w = list(map(int,input().split())) limit = int(input()) sum = 0 weight = [] for i in w: if i <= limit: weight.append(i) while weight: m = max(weight) n = min(weight) try: if (m + n) <= limit: sum += 1 weight.pop(weight.index(m)) weight.pop(weight.index(n)) else : sum += 1 weight.pop(weight.index(m)) except Exception: pass print(sum)
#笔试题目##完美世界#