上官小胖 @ 2017-10-03 16:37:39
#include <bits/stdc++.h>
using namespace std;
int n,s,x[10000],y[10000],ans,a,b,l,d[10000];
int main()
{
cin>>n>>s>>a>>b;
l=a+b;
for (int i=0;i<n;i++)
cin>>x[i]>>y[i];
int k=0;
for (int i=0;i<n;i++)
{
if (x[i]<=l)
{
d[k]=y[i];
k++;
}
}
sort(d,d+k);
int i=0;
while (s-d[i]>=0)
{
ans++;
s-=d[i];
i++;
}
cout<<ans<<endl;
return 0;
}
第四个测试点WA
by 上官小胖 @ 2017-10-03 16:50:47
已解决
呵呵呵
by originate @ 2018-01-19 00:25:11
@叶浩徐 没记错的话是那个0 0 0 0的,真是气死人