???Henu ACM Round#17 B???USB Flash Drives

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了???Henu ACM Round#17 B???USB Flash Drives相关的知识,希望对你有一定的参考价值。

?????????turn   div   efi   sort   bit   black   pac   ack   blog   

???????????? ????????????,?????????:)
????????????


?????????????????????

????????????


??????,????????????????????????????????????

????????????

#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int M =1e5;

int f[M+10],a[1000+10],n,m;

int main()
{
    ios::sync_with_stdio(0),cin.tie(0);
    #ifdef LOCAL_DEFINE
        freopen("rush.txt","r",stdin);
    #endif // LOCAL_DEFINE
    cin >> n >> m;
    for (int i = 1;i <= n;i++) cin >> a[i];
    sort(a+1,a+1+n);
    reverse(a+1,a+1+n);
    int cnt = 0;
    for (int i = 1;i <= n && m>0;i++){
        m-=a[i];
        cnt++;
    }
    cout <<cnt<<endl;
    return 0;
}

以上是关于???Henu ACM Round#17 B???USB Flash Drives的主要内容,如果未能解决你的问题,请参考以下文章

Henu ACM Round#16 B Bear and Colors

Henu ACM Round#19 B Luxurious Houses

Henu ACM Round#19 FDispute

Henu ACM Round#19 A Vasya the Hipster

Henu ACM Round#15 A A and B and Chess

Henu ACM Round#15 BA and B and Compilation Errors