Cod sursa(job #630672)
Utilizator | Neagoe Alexandru pykh | Data | 6 noiembrie 2011 12:39:39 |
---|---|---|---|
Problema | Statistici de ordine | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include<cstdio>
#include<algorithm>
using namespace std;
const char in[]="sdo.in";
const char out[]="sdo.out";
const int N = 3000001;
int k, n, v[N];
int main()
{
freopen(in,"r",stdin);
freopen(out,"w",stdout);
scanf("%d %d", &n, &k);
for(int i = 1 ; i <= n ; ++i)
scanf("%d", &v[i]);
nth_element(v + 1, v + k, v + 1 + n);
printf("%d", v[k]);
return 0;
}