求助,这里错哪了

P2676 [USACO07DEC] Bookshelf B

```cpp #include<bits/stdc++.h> using namespace std; int h[50001]; int s=0,a=0; bool c(int a,int b) { return a>b; } int main() { int n,b; cin>>n>>b; for(int i=0;i<n;i++) { cin>>h[i]; } sort(h,h+n,c); while(s<b) { s+=h[a]; a++; } cout<<a; return 0; } ``` 这样写
by gzy0215 @ 2023-08-17 18:05:30


|