@[一个神奇的人](/space/show?uid=235934) 你这个本地测评都有问题;
by AK_黄铮_IMO @ 2019-09-27 15:32:54
@[一个神奇的人](/space/show?uid=235934) s不是全局变量,在jntm里用不了
by jxyzs @ 2019-09-27 15:46:29
.
by Pengsibo @ 2019-09-27 16:19:28
# 考点:自定义排序
```cpp
#include<bits/stdc++.h>
using namespace std;
struct apple{
int x;
int y;
};
apple k[5000];
bool cmp(apple a,apple b){
return a.y<b.y;
}
int main(){
int n,s,a,b;
cin>>n>>s>>a>>b;
b+=a;
for(int i=0;i<n;i++){
cin>>k[i].x>>k[i].y;
}
for(int i=0;i<n;i++){
if(k[i].x>b){
k[i].y=101;
}
}
sort(k,k+n,cmp);
int ans=0;
for(int i=0;i<n&&s-k[i].y>=0;i++){
if(k[i].y!=101){
ans++;
s-=k[i].y;
}
}
cout<<ans;
return 0;
}
```
by Frainstak @ 2019-09-27 16:31:37
@[jxyzs](/space/show?uid=133922) 谢了
by 一个神奇的人 @ 2019-09-28 21:52:13
@[ProgrammerRaymond](/space/show?uid=185092) 感谢
by 一个神奇的人 @ 2019-09-28 22:01:41