Pagini recente » Cod sursa (job #256899) | Cod sursa (job #1355558) | Cod sursa (job #2424780) | Cod sursa (job #3206571) | Cod sursa (job #2088809)
#include <fstream>
#include <algorithm>
using namespace std;
int main()
{
int numarElemente, statisticaOrdine;
ifstream fin("sdo.in");
fin >> numarElemente >> statisticaOrdine;
statisticaOrdine--;
int *multime = new int[numarElemente];
for(int i=0; i<numarElemente; i++)
fin >> multime[i];
nth_element(multime, multime + statisticaOrdine, multime + numarElemente);
ofstream fout("sdo.out");
fout << multime[statisticaOrdine];
delete[] multime;
return 0;
}