Codeforces 1165 B. Polycarp Training solution
Solve in C++:
///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include<iostream>
- #include<algorithm>
- using namespace std;
- int main()
- {
- int n,i,a[200900],c=0;
- cin>>n;
- for(i=0; i<n; i++)
- {
- cin>>a[i];
- }
- sort(a,a+n);
- for (i=0;i<n;i++)
- {
- if(a[i]>c)
- {
- c++;
- }
- }
- cout<<c<<endl;
- }
No comments