Cod sursa(job #2873048)

Utilizator andreipirjol5Andrei Pirjol andreipirjol5 Data 18 martie 2022 15:27:06
Problema Statistici de ordine Scor 60
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.45 kb
#include <cstdio>
#include <algorithm>

using namespace std;
FILE *fin , *fout;

#define NMAX 4000000
int v[NMAX + 5];

int main()
{
    fin = fopen("sdo.in" , "r");
    fout = fopen("sdo.out" , "w");

    int n , k;
    fscanf(fin , "%d%d" , &n , &k);
    for(int i = 1; i <= n; i++)
        fscanf(fin , "%d" , &v[i]);
    sort(v + 1 , v + n + 1);

    fprintf(fout , "%d" , v[k]);

    fclose(fin);
    fclose(fout);
    return 0;
}