鲲鲲睡觉蹦迪 @ 2019-09-29 10:38:44
def liqi(x):
return x[1]
sum = 0
n,s = input().split()
n,s = int(n), int(s)
a,b = input().split()
a,b = int(a), int(b)
c = a+b
apples = []
for i in range(n):
apples.append(input().split(' '))
apples.sort(key=liqi)
for i in range(len(apples)):
if int(apples[i][0]) <= c and int(apples[i][1]) <= s:
s = s - int(apples[i][1])
sum+=1
print(sum)
by xQAQyn @ 2019-09-29 17:58:40
新晋python大佬%%%%%%%%%%
by pissingboy @ 2019-10-13 14:31:07
我是萌新,也没过,看了你的代码借鉴学习,试着调试了下,觉得逻辑没问题,只是循环的有点长,数据多了用时会长些。没发现大的问题,问题解决了吗?请告知原因。