Cod sursa(job #1669925)
Utilizator | Data | 31 martie 2016 11:29:04 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <bits/stdc++.h>
using namespace std;
int N, K, j;
vector<int> V;
int main(){
freopen("sto.in", "r", stdin);
freopen("sto.out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cin >> N >> K;
for(int i = 1; i <= N; i++){
cin >> j;
V.push_back(j);
}
K--;
nth_element(V.begin(), V.begin() + K, V.end());
cout << V[K];
return 0;
}