mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-02-02 20:20:07 +00:00
P2676 [USACO07DEC] Bookshelf B
R38819026
This commit is contained in:
parent
40e26e2bf5
commit
07db60b85e
19
problem/P2676/P2676.cpp
Normal file
19
problem/P2676/P2676.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// R38819026
|
||||||
|
|
||||||
|
#include<bits/stdc++.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int n, h[20005], b, sum=0, i;
|
||||||
|
cin >> n >> b;
|
||||||
|
for(i = 0 ; i < n ; i++) {
|
||||||
|
cin >> h[i];
|
||||||
|
}
|
||||||
|
sort(h, h+n);
|
||||||
|
while(sum < b) {
|
||||||
|
sum += h[--i];
|
||||||
|
}
|
||||||
|
cout << n-i << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user