不是VIP会员,不能显示答案

题目解答

题目:
Program exp1 (imput,output);
Var i, s, max: integer;
a :array [1..10] of integer;
begin
for i:=1 to 10 do read (a[i]);
max:=a[1] ;s:=a[1];
for i:=2 to 10 do
begin
if s<0 then s:=0;
s:= s+a[i];
if s>max then max:=s
end;
writeln(‘max=’, max)
end.
输入:-2 13 -1 4 7 8 -1 -18 24 6
输出:max=42
考点:
分析:
解答:
评论:
老师: