这题也太水了,我还以为很难
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int N=1e6+10;
struct node{
int x,y;
}apple[N];
int n,s,a,b,ans;
bool cmp(node a,node b){
return a.y<b.y;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>n>>s>>a>>b;
for(int i=1;i<=n;i++) cin>>apple[i].x>>apple[i].y;
sort(apple+1,apple+1+n,cmp);
for(int i=1;i<=n;i++){
if(a+b>=apple[i].x&&s>=apple[i].y){
s-=apple[i].y;
ans++;
}
}
cout<<ans<<endl;
return 0;
}
就这个代码,本蒟蒻居然一遍写对???