Dongbaitao @ 2020-02-09 11:23:15
#include<iostream>
using namespace std;
int main()
{
int n,s,a,b,h,t=0;
cin>>n>>s>>a>>b;
h=a+b;
int x[n],y[n];
for(int i=0;i<n;i++)
{
cin>>x[i]>>y[i];
}
for(int j=0;j<n;j++)
{
s-=y[j];
if(x[j]<h&&s>0)
{
t++;
}
else if(s<=0)
{
break;
}
}
cout<<t<<endl;
return 0;
}
看着没问题啊,为什么过不了,求助大佬QAQ
by why666 @ 2020-02-10 12:20:09
@Dongbaitao
by why666 @ 2020-02-10 12:21:41
摘苹果是没问题的了,可是您没有排序啊,要优先选择最省力的苹果摘
by Dongbaitao @ 2020-02-10 13:15:45
知道了,谢谢大佬