Pagini recente » Cod sursa (job #962850) | Cod sursa (job #426280) | Cod sursa (job #770865) | Cod sursa (job #1325478) | Cod sursa (job #424995)
Cod sursa(job #424995)
#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=0;i<n;i++){
get_int(x[i]);
}
nth_element(x,x+k,x+n);
printf("%d\n",x[k]);
return 0;
}