Huayecai @ 2024-09-11 20:55:41
#include<bits/stdc++.h>
using namespace std;
struct apple{
int c,d;
}p[5050];
bool hh(apple x,apple y){
return x.d<y.d;
}
int main(){
int n,s,a,b;
cin>>n>>s;
cin>>a>>b;
int can=0;
for(int i=0;i<n;i++){
int l,k;
cin>>l>>k;
if(l<=a+b){
p[can].c=l;
p[can].d=k;
can+=1;
}
}
sort(p,p+can,hh);
int j=0,sum=0;
while(s>=0){
j+=1;
sum+=1;
s-=p[j].d;
}
cout<<sum<<endl;
}
by fuxueziyi @ 2024-11-04 21:41:48
@玉树临风英俊潇洒 感谢,我也有同样的问题。已关