Program z1; var a:array[1..100] of integer; i,n,ma,mau:integer; begin assign(input,'in.txt'); reset(input); readln(n); for i:=1 to n do begin read(a[i]); end; close(input); ma:=a[1];mau:=1; for i:=1 to n do begin if a[i]>ma then begin ma:=a[i];mau:=i end; end; a[mau+1]:=2*ma; if mau=n then n:=n+1; assign(output,'out.txt'); rewrite(output); for i:=1 to n do begin write(a[i],' ') end; close(output) end.
var a:array[1..100] of integer;
i,n,ma,mau:integer;
begin
assign(input,'in.txt');
reset(input);
readln(n);
for i:=1 to n do begin
read(a[i]);
end;
close(input);
ma:=a[1];mau:=1;
for i:=1 to n do begin
if a[i]>ma then begin
ma:=a[i];mau:=i
end;
end;
a[mau+1]:=2*ma;
if mau=n then n:=n+1;
assign(output,'out.txt');
rewrite(output);
for i:=1 to n do begin
write(a[i],' ')
end;
close(output)
end.