Never_and_Ever @ 2018-07-24 17:15:50
#include<bits/stdc++.h>
using namespace std;
int ky[5000],kx[5000],ans=0,a,b,maxx;
int n,s,x[5000],y[5000],d=1,vv=0;
int main()
{ int i;
cin>>n>>s;
cin>>a>>b;
for(i=1;i<=n;i++)
cin>>x[i]>>y[i];
maxx=a+b;
for(i=1;i<=n;i++){
if(x[i]<=maxx){
kx[d]=x[i];
ky[d]=y[i];
d++;}
} sort(ky,ky+d);
for(i=1;i<=n;i++){
if(vv+ky[i]<=s)
ans++;
vv=vv+ky[i];
}
cout<<ans;
return 0;
}
by Never_and_Ever @ 2018-07-24 17:19:03
我知道了
by 灯芯糕 @ 2018-07-29 10:59:17
.....
by 旧巷听风丶 @ 2018-08-01 21:42:01
数组开小了,开到10000试试 之前我就跪在这儿