edjzy @ 2019-01-22 08:27:16
为何第五点WA???
#include<bits/stdc++.h>
using namespace std;
int n,s,a,b,x[5010],y[5010],ans;
int main()
{
cin>>n>>s>>a>>b;
a+=b;
if(n==0)
{
cout<<0;
return 0;
}
for(int i=1;i<=n;i++)
scanf("%d %d",&x[i],&y[i]);
sort(y+1,y+n+1);
for(int i=1;i<=n;i++)
{
if(x[i]<=a&&y[i]<=s)
{
ans++;
s-=y[i];
}
}
cout<<ans;
return 0;
}