Cod sursa(job #1666146)
Utilizator | Data | 27 martie 2016 18:37:12 | |
---|---|---|---|
Problema | Statistici de ordine | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
unsigned int v[3000005];
int main()
{
ifstream f("sdo.in");
ofstream g("sdo.out");
int n,i,k;
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';
f.close();
g.close();
return 0;
}