import java.util.*;
class task4
{
public static int FindMax(double[] resRun, int[] nRun)
{
double max = resRun[0];
int maxN = 0;
for (int i=1; i<resRun.length; i++)
{
if (resRun[i] > max)
{
max = resRun[i];
maxN = i;
}
}
return maxN;
}
public static void main
(String[] args
) {
final int teamSize = 4; //размер отбираемой команды
int n; //количество бегунов
int[] nRun = new int[teamSize]; //номера бегунов
double[] resRun = new double[teamSize]; //результаты этих бегунов
Scanner in
= new Scanner
(System.
in); n = in.nextInt();
if (n < teamSize)
{
System.
out.
println("n не должно быть меньше 4"); return;
}
double max = 0; //результат худшего бегуна в отобранной команде для сравнения с очередным результатом
int maxN = 0; //номер (индекс) худшего бегуна в массиве
for (int i = 0; i < n; i++)
{
double a = in.nextDouble();
if (a <= 0)
{
System.
out.
printf("Результаты должны быть больше 0"); return;
}
if (i<teamSize) //заполяем команду первыми попавшимися бегунами
{
nRun[i] = i;
resRun[i] = a;
if (i==teamSize-1)
{
maxN = FindMax(resRun, nRun);
max = resRun[maxN];
}
}
else if (a < max) //заменяем бегуна с наихудшим результатом бегуном, с лучшим результатом
{
resRun[maxN] = a;
nRun[maxN] = i;
maxN = FindMax(resRun, nRun);
max = resRun[maxN];
}
}
for (int i = 0; i<teamSize; i++)
{
System.
out.
println(nRun
[i
]+1); }
}
}
aW1wb3J0IGphdmEudXRpbC4qOwoKY2xhc3MgdGFzazQKewkKCXB1YmxpYyBzdGF0aWMgaW50IEZpbmRNYXgoZG91YmxlW10gcmVzUnVuLCBpbnRbXSBuUnVuKQoJewoJCWRvdWJsZSBtYXggPSByZXNSdW5bMF07CgkJaW50IG1heE4gPSAwOwoJCWZvciAoaW50IGk9MTsgaTxyZXNSdW4ubGVuZ3RoOyBpKyspCgkJewoJCQlpZiAocmVzUnVuW2ldID4gbWF4KQoJCQl7CgkJCQltYXggPSByZXNSdW5baV07CgkJCQltYXhOID0gaTsKCQkJfQoJCX0KCQlyZXR1cm4gbWF4TjsKCX0KCQoJcHVibGljIHN0YXRpYyB2b2lkIG1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