bohemiao @ 2023-09-21 17:24:19
#include<bits/stdc++.h>
using namespace std;
int a[5005],n,s,b[5005],aa,bb,sum,c[5005];
int main(){
cin>>n>>s;
for(int i=1;i<=n;i++) cin>>a[i]>>b[i];
cin>>aa>>bb;
aa+=bb;
for(int i=1;i<=n;i++){
if(a[i]<=aa){
c[i]=b[i];
}
}
sort(c+1,c+1+n);
for(int i=1;i<=n;i++){
if(c[i]!=0&&s-c[i]>=0){
s-=c[i];
sum++;
}else break;
}
cout<<sum;
return 0;
}
只对了#4
有没有0力气摘苹果的