Массив не обязательно начинать с -10000

я бы написал как-то так
Граничные условия
d[0]:=1;
d[n+1]:=1;
переменные
curr:=0;
max:=0;
Затем цикл
Код
for i:=1 to n do
begin
if (d[i-1]>0) and (d[i]<=0) then
curr:=0;
if (d[i]<=0) then
curr:=curr+1;
if (d[i]<=0) and (d[i+1]>0) then
if (curr>max) then max:=curr;
end;
begin
if (d[i-1]>0) and (d[i]<=0) then
curr:=0;
if (d[i]<=0) then
curr:=curr+1;
if (d[i]<=0) and (d[i+1]>0) then
if (curr>max) then max:=curr;
end;
В переменной max должен быть максимальный период.
Писал сразу здесь, может что-то пропустил
