Переведите на алгоритмический язык program model;
var i, i1, if1, noted, nend : integer;
ta, tb, dt, t, pot: real;
a: array[1..3] of real;
b : array[1..3] of real;
tod : array[1..2] of real;
tz : array[1..3] of real;
tp: array[1..2] of real;
nz: array[1..3] of integer;
np: array[1..2] of integer;
n: array[1..2] of integer;
procedure DAT (a,b : real; var c:real);
begin
randomize;
c := a + random (round ( b ));
end;
begin
for i:=1 to 3 do
readln (a [i], b [i]);
readln (ta, tb, dt);
for i:=1 to 3 do
begin
nz [i]:= 0;
if i < 3 then
begin
n[i] := 0;
np[i] := 0;
end;
end;
for i1:= 1 to 5 do
begin
nend:= 0;
noted:= 0;
t:= 0;
for i:= 1 to 3 do
begin
tz[i]:= 0;
if i < 3 then tp[ i ]:= 0
end;
while nend < 150 do
begin
for i:= 1 to 2 do
if np[i] = 1 then
if tp[i]<=0 then
begin
np[i]:= 0;
nend:= nend + 1;
end;
if1:= 0;
for i:= 1 to 3 do
begin
if nz[ i ] = 1 then
if tz[ i ] < 0 then
begin
if1:= 1;
nz[ i ]:= 0;
if i = 3 then n[2]:= n[ 2 ] + 1
else n[1]:= n[ 1 ] + 1
end;
end;
for i:= 1 to 2 do
if n[i] > 0 then
if np[i]= 0 then
begin
n[i]:= n[i] - 1;
np[i]:= 1;
tp[i]:= tod[ i ]
end;
if t <=0 then
begin
if1:= 0;
for i:= 1 to 3 do
if if1 = 0 then
if nz[ i ] = 0 then
begin
nz[ i ]:= 1;
DAT ( a[ i ], b[ i ], tz[ i ] );
if1:= 1;
end;
if if1 = 0 then noted:= noted + 1;
DAT ( ta, tb, t );
end;
t:= t - dt;
for i:= 1 to 3 do
begin
if i < 3 then tp[i]:= tp[ i ] - dt;
tz[i]:= tz[i] - dt;
end;
end;
end;
pot:= noted/( nend + noted);
writeln ( nend);
writeln (noted);
writeln (pot);
end.
var x : array[1..n] of real;
i : integer; min : real;
begin
Randomize;
writeln('Исходный массив:');
for i:=1 to n do
begin
x[i]:=20*random-10;
write(x[i]:6:2,' ');
end;
writeln;
min:=x[1];
for i:=2 to n do
if x[i] < min then min:=x[i];
writeln('min=',min:6:2);
for i:=1 to n do
if x[i]<0 then x[i]:=min;
writeln('Измененный массив:');
for i:=1 to n do write(x[i]:6:2,' ');
end.
Пример:
Исходный массив:
-7.84 -9.97 7.00 -8.26 -7.71 -3.88 7.59 -2.32
min= -9.97
Измененный массив:
-9.97 -9.97 7.00 -9.97 -9.97 -9.97 7.59 -9.97