Cod sursa(job #1205780)

Utilizator hasmasandragosHasmasan Dragos hasmasandragos Data 8 iulie 2014 01:23:36
Problema Statistici de ordine Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.28 kb
#include <fstream>
#include <algorithm>
#define Nmax 3000005
using namespace std;

ifstream f("sdo.in");
ofstream g("sdo.out");

int a[Nmax],n,i,k;

int main()
{
    f>>n>>k;
    for (i=0;i<n;i++)
     f>>a[i];
    nth_element(a,a+k-1,a+n);
    g<<a[k-1];
    return 0;
}