Cod sursa(job #3246293)

Utilizator Andrei24543Andrei Hulubei Andrei24543 Data 2 octombrie 2024 17:37:03
Problema Statistici de ordine Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.38 kb
#include <bits/stdc++.h>
using namespace std;

ifstream fin("sdo.in");
ofstream fout("sdo.out");

int n , a[3000005] , k;

int main()
{
    int i;
    fin >> n >> k;
    for(i = 1;i <= n;i++)
        fin >> a[i];
    sort(a + 1 , a + n + 1);
    fout << a[k];
    return 0;
}
/**
5 3
4 -2 2 = 0
3 -1 5 = 3
2 0 -3 = -5
4 1 -3 = -8
5 -3 2 = 0
-------
1 1 0
*/