Вот что вышло:
Code
program_4;
uses crt;
type
rec=record;
god: integer;
M: real;
end;
const MAXP=30;
var
Mas: array[1..MAXP] of Rec;
N: integer;
YO, YT: integer;
i, j, d: integer;
IskY, IskD: integer;
f: boolean;
begin
clrscr;
write('Vvedite god nachala analiza: ');
readln(YO);
repeat
write('Vvedite prodolgitelnost sroka analiza (ne bolshe',MAXP,' let): ');
readln(N);
if (N<1) or (N>MAXP) then
writeln('Vvedeno nedopustimoe znachenie');
until(N>=1) and (N<=MAXP);
clrscr;
writeln('Vvod xnachenia parametra M za razlichnye goda');
for i:=1 to N do
begin
mas[i].God:=YO+i-1;
write('Vvedite znachenie M za', Mas[i].God,'god');
readln(mas[i].M);
end;
IskY:=1;
IskD:=1;
d:=1;
f:=false;
for i:=2 to N do
begin
if Mas[i].M=Mas[i-1].M then
begin
if f=false then
begin
f:=true;
d:=2;
YT:=i-1;
end;
else
d:=d+1;
end;
else
if f=true then
begin
f:=false;
if d>IskD then
begin
IskD:=D;
IskY:=YT;
end;
d:=1;
end;
end;
if(f=true) and (d>IskD) then
begin
IskD:=d;
IskY:=YT;
end;
write('Samyi dlinnyi period postoyanstva M: ');
write(Mas[IskY].God,'-:-');
writeln(Mas[IskY+IskD-1].God);
writeln('pri M=', Mas[IskY].M:7:2);
readln;
end.