一个点RE求助

P1478 陶陶摘苹果(升级版)

CuberAC @ 2019-10-01 20:12:13

include<bits/stdc++.h>

using namespace std; int n,s,a,b,ans,x,y,f[50005]; bool cmp(int x,int y){ return x<y; } int main(){ scanf("%d%d%d%d",&n,&s,&a,&b); int t=1; for(int i=1;i<=n;i++){ scanf("%d%d",&x,&y); if(x<=a+b){ f[t]=y; t++; } } t--; sort(f+1,f+t+1,cmp); t=1; while(s>=0){ s-=f[t]; t++; ans++; } if(ans<0)cout<<0; else cout<<ans-1; }


by 汪♀思♀聪 @ 2019-10-01 20:12:52

望丰展?使MD


by CuberAC @ 2019-10-01 20:15:35

@汪♀思♀聪 表示听不懂


by 汪♀思♀聪 @ 2019-10-01 20:16:17

@CuberAC

希望更丰富的展现?使用Markdown


|