program Olimp_11_2;
var
i,n,j,k:integer;
z,x,y,m: array[0..20] of integer;
f,g:text;
begin
assign (f,'input.txt');
reset (f);
readln (f,n);
For i:= 1 to n do begin
readln(f,x[i]);
y[i]:=i;
end;
close (f);
For i:=1 to n do
z[i]:=x[i];
For j:=1 to n do
For i:= 1 to n-1 do
If z[i]>z[i+1] then begin
k:=z[i];
z[i]:=z[i+1];
z[i+1]:=k;
end;
For i:=1 to n do
For j:=1 to n do
if z[i]=x[j] then
m[i]:=y[j];
assign (g,'output.txt');
rewrite (g);
For i:= 1 to 4 do
writeln(g,z[i],' ',m[i]);
close (g);
end.
var
i,n,j,k:integer;
z,x,y,m: array[0..20] of integer;
f,g:text;
begin
assign (f,'input.txt');
reset (f);
readln (f,n);
For i:= 1 to n do begin
readln(f,x[i]);
y[i]:=i;
end;
close (f);
For i:=1 to n do
z[i]:=x[i];
For j:=1 to n do
For i:= 1 to n-1 do
If z[i]>z[i+1] then begin
k:=z[i];
z[i]:=z[i+1];
z[i+1]:=k;
end;
For i:=1 to n do
For j:=1 to n do
if z[i]=x[j] then
m[i]:=y[j];
assign (g,'output.txt');
rewrite (g);
For i:= 1 to 4 do
writeln(g,z[i],' ',m[i]);
close (g);
end.
Комментариев нет:
Отправить комментарий