题目: |
program test3;
var i,j,max:integer;
a,s:array[0..8] of integer;
begin
max:=-32765;
for i:=0 to 8 do s[i]:=0;
for i:=1 to 8 do
begin
read(a[i]);
s[i]:=s[i-1]+a[i];
end;
for i:=0 to 7 do
for j:=i+1 to 8 do
if s[j]-s[i]>max then max:= s[j]-s[i];
write(max, ’ ‘);
for i:=1 to 7 do write(s[i], ‘ ‘);
end.
输入: 46 36 46 11 28 28 21 18 输出:46 36 46 11 28 28 21 18
|