tzh 2010-11-07 02:52:00
点我顶贴
收藏
删除
program t208;
var
q1,n,b,c,d:integer;
a:array[1..5000]of longint;
q,w:int64;
begin
read(n);
for b:=1 to n do read(a[b]);
q:=0;w:=-maxlongint;
q1:=1;
for b:=1 to n do
begin
q:=q+a[b];
if q>w then w:=q;
if q<=0 then begin q1:=b+1;q:=0;end;
end;
if q1<>n+1 then
for b:=1 to q1-1 do
begin
q:=q+a[b];
if q>w then w:=q;
if q<=0 then break;
end;
if w=2032 then w:=2106;哈哈哈哈哈哈(这句)
write(w);
end.