Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int differentValuesOfK(int N,int A,int B,int D[]){
- sort(D,D+N);
- return D[B]-D[B-1];
- }
- int main(){
- int N,A,B;
- cin>>N>>A>>B;
- int D[N];
- for(int i=0;i<N;i++){
- cin>>D[i];
- }
- cout<<differentValuesOfK(N,A,B,D)<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment