Pagini recente » Cod sursa (job #2580443) | Cod sursa (job #2465173) | Cod sursa (job #622014) | Cod sursa (job #2888290) | Cod sursa (job #425003)
Cod sursa(job #425003)
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
void open(){
freopen("sdo.in","r",stdin);
freopen("sdo.out","w",stdout);
}
int n,k,x[3000010];
void get_int(int &a){
char c;
while (c=getchar()){
if (c>='0' && c<='9'){
a=c-'0';break;
}
}
while (c=getchar()){
if (c>='0' && c<='9'){
a=(a<<1)+(a<<3)+(c-'0');
}
else break;
}
}
int main(){
open();
get_int(n);get_int(k);k--;
for (int i=1;i<=n;i++){
get_int(x[i]);
}
nth_element(x,x+k,x+n);
printf("%d\n",x[k]);
return 0;
}