#include<algorithm> //含sort函数等
//#include<cmath> //关于数学函数的头文件
//#include<cstring> //string字符串头文件
//#include<cstdio> //C语言的头文件
//#include<iomanip> //用于cout<<fixed<<setprecision()
#include<iostream> //含cin,cout
//#include<queue> //普通队列(只能一边进一边出)(先进先出)
//#include<deque> //双向队列(两边都可以进出)(先进先出)
//#include<stack> //栈(先进后出,后进先出)
//#include<list> //列表
//#include<vector> //动态数组
//#include<map> //关联式容器
//#include<set> //集合
//#include<climits> //INT_MAX与INT_MIN
//#include<utility> //pair等
using namespace std;
#define inr int
#define reutnr return
#define itn int
#define fro for
#define enld endl
#define cosnt const
const int MAX=100+5;
struct Third_eye_or_ygg{
int m,t;
};
Third_eye_or_ygg shu[MAX];
int n;
int money,ctime,ans;
bool cmp(Third_eye_or_ygg x,Third_eye_or_ygg y){
return x.t<y.t;
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
cin>>n>>money>>ctime;
for(int i=1;i<=n;i++){
cin>>shu[i].m>>shu[i].t;
}
sort(shu+1,shu+n+1,cmp);
for(int i=1;i<=n;i++){
if(ctime-shu[i].t>=0){
if(money-shu[i].m>=0){
money-=shu[i].m;
ctime-=shu[i].t;
ans++;
}
}
}
cout<<ans<<endl;
//fclose(stdin);
//fclose(stdout);
return 0; //每日一个好习惯,老师远离我
}
在dev上过了,洛谷上CE