Cod sursa(job #2450234)
Utilizator | Data | 22 august 2019 13:18:18 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 70 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <cstdio>
#include <algorithm>
using namespace std;
const int N=(int)3e6+7;
int n,k,a[N];
int main()
{
freopen("sdo.in","r",stdin);
freopen("sdo.out","w",stdout);
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
nth_element(a+1,a+k,a+n+1);
printf("%d\n",a[k]);
return 0;
}