fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. int main() {
  5. int n;
  6. cin >> n;
  7. int arr[n];
  8. for (int i=0; i<n; i++) cin >> arr[i];
  9. sort(arr,arr+n);
  10. int t=0,a=0;
  11. while (t<n-a) {
  12. t+=arr[a];
  13. a++;
  14. }
  15. cout << n-a;
  16. }
  17.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
Standard output is empty