#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int NUM;
int da;
cin>>NUM>>da;
vector<int> a;
for(int i=0;i<NUM;i++)
{
int pp;
cin>>pp;
a.push_back(pp);
}
sort(a.begin(),a.end());
int t=0;
int js=0;
for(int i=NUM-1;i>=0;i--)
{
t=t+a[i];
js++;
if(t>=da)
{
break;
}
}
cout<<js;
return 0;
}
POJ 3627 Bookshelf G++
最新推荐文章于 2018-10-11 20:05:39 发布