Advertisement
Saleh127

CF 682B.cpp

Aug 8th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 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. int a[200005],c,d=1,e,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.  
  16. for(i=0;i<c;i++)
  17. {
  18. if(a[i]>=d)
  19. {
  20. d++;
  21. }
  22. }
  23. cout<<d<<endl;
  24. return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement