呼叫liuser(Py背包)

JupHamaster 木星拜 2021-01-31 23:52:42 2021-02-01 15:15:29 0

大概有一个架构了,但是出了大问题

n,c = input().split()               
n = int(n)                  
c = int(c)                  
a = input().split()             
l = []              
s = 0               
for i in a:                 
    l.append(int(i))                
while True:             
    if s == n:              
        break               
    else:               
        for i in l:             
            c-=min(l)               
            if c < 0:               
                break                   
            else:                       
                l.remove(min(l))                
                s+=1                
print(s)                
{{ vote && vote.total.up }}