Advertisement
Saleh127

CF 545D

Aug 9th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);cout.tie(0);
  7.  
  8. long long a[200000],c,d=0,e=0,f,i,j,k,l;
  9. cin>>c;
  10. for(i=0;i<c;i++)
  11. {
  12. cin>>a[i];
  13. }
  14. sort(a,a+c);
  15. for(i=0;i<c;i++)
  16. {
  17. if(d<=a[i])
  18. {
  19. e++;
  20. d+=a[i];
  21. }
  22. }
  23. cout<<e<<endl;
  24. return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement