var mas: array [1..n] of integer; i, max1, max2: integer;
begin randomize; for i := 1 to n do mas[i] := -20 + random(40); if mas[1] < mas[2] then begin max1 := mas[2]; max2 := mas[1] end else begin max1 := mas[1]; max2 := mas[2] end; for i := 3 to n do if max1 < mas[i] then begin max2 := max1; max1 := mas[i] end else if max2 < mas[i] then max2 := mas[i]; writeln(max1:3, max2:3); end.
var
mas: array [1..n] of integer;
i, max1, max2: integer;
begin
randomize;
for i := 1 to n do
mas[i] := -20 + random(40);
if mas[1] < mas[2] then begin
max1 := mas[2];
max2 := mas[1]
end
else begin
max1 := mas[1];
max2 := mas[2]
end;
for i := 3 to n do
if max1 < mas[i] then begin
max2 := max1;
max1 := mas[i]
end
else
if max2 < mas[i] then
max2 := mas[i];
writeln(max1:3, max2:3);
end.