Cod sursa(job #713609)
Utilizator | Data | 14 martie 2012 19:45:08 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.27 kb |
#include <fstream>
#include <algorithm>
using namespace std;
int n,k,v[3000001],i;
int main() {
ifstream f("sdo.in");
ofstream g("sdo.out");
f>>n>>k;
for (i=1; i<=n; i++)
f>>v[i];
nth_element(v+1,v+k,v+n+1);
g<<v[k]<<'\n';
g.close();
return 0;
}