题目: |
Program test_2013_3;
Var i,s,m:integer; a:array[1..10] of integer;
begin
for i:=1 to 10 do read(a[i]);
m:=0; s:=0;
for i:=1 to 10 do begin
if a[i]<0 then begin
if s>m then m:=s;
s:=0 end
else s:=s+a[i];
end;
if s>m then m:=s;
writeln(‘m=’:m);
end.
输入:-5 13 -1 4 7 8 -1 -18 24 6 输出:30
|