#include <bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[],int N);
int main() {
int N,B,S,P=0;
cin>>N>>B;
int Hi[N];
while (cin>>Hi[P]) {
P++;
}
P=0;
bubbleSort(Hi, N);
for (int f=N;f<=N;f--) {
P++;
S += Hi[f];
if (S>=B) {
cout<<P;
break;
}
}
return 0;
}
void bubbleSort(int arr[], int N) {
for (int i=0;i<N;i++) {
for (int j=0;j<N-i;j++) {
if (arr[j] > arr[j+1]) swap(arr[j],arr[j+1]);
}
}
return;
}
代码全是错的却跑出95这档事
