万弘 @ 2017-12-09 20:50:55
#include<bits/stdc++.h>
using namespace std;
int xi[5000],yi[1000];
int main(){
int n,s,a,b,js=1;
cin>>n>>s>>a>>b;
for(int i=1;i<=n;i++)
cin>>xi[i]>>yi[i];
a+=b;
for(int i=1;i<n;i++)
for(int x=1;x<=n-i;x++)
if(yi[x]<yi[x+1]){
int ls1=yi[x];yi[x]=yi[x+1];yi[x+1]=ls1;
int ls2=xi[x];xi[x]=xi[x+1];xi[x+1]=ls2;//排序
}
for(int i=1;i<=n;i++)
if(xi[i]<a&&yi[i]<s){
js++;s-=yi[i];//是否能摘
}
cout<<js;
return 0;
}
by 凑_友希那 @ 2017-12-09 21:38:57
试一试这组
0 0 0 0
by xyx_xcc @ 2017-12-10 11:02:52
我是神犇,不好意思(滑稽)