CodeChef::JOHNY

 

#include <bits/stdc++.h>
using namespace std ;

int main (){
int t ;
cin >> t ;
while (t--){
int n ;
cin >> n ;
long int a[n] ;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
int k ;
cin >> k ;
int smallest{0} ;
for (int i = 0; i < n; ++i) {
if (a[i] < a[k-1]){
smallest ++ ;
}
}
cout << smallest + 1 << '\n';


}

return 0;
}

Comments

Popular posts from this blog

CodeChef::CSUB

How Recursion Works?

CodeChef::TREE2