uses crt;
var i,j,tong,max,n,ton:longint; a:array[1..10000]of longint;
begin
clrscr;
write('N=');readln(n);
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
end;
i:=0;
repeat
inc(i); j:=i; tong:=0;
while (j<=n)and(a[j]>0) do begin inc(tong,a[j]); inc(j); end;
if tong>ton then begin max:=j-i; ton:=tong; end;
i:=j;
until i>=n;
writeln('So luong so duong lien tiep co tong lon nhat la: ',max);
readln
end.
////////////////////////////////////////////////
Một số text cho bạn tham khảo: