#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
vector<int> v(n);
for(int i=0; i<n; ++i)
cin>>v[i];
sort(v.begin(),v.end());
cout<<n-(lower_bound(v.begin(),v.end(),v[n-k])-v.begin())<<endl;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; vector<int> v(n); for(int i=0; i<n; ++i) cin>>v[i]; sort(v.begin(),v.end()); cout<<n-(lower_bound(v.begin(),v.end(),v[n-k])-v.begin())<<endl; return 0; } |
English