/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 1ms 256.0 KiB
#2 Accepted 1ms 256.0 KiB
#3 Accepted 1ms 256.0 KiB
#4 Accepted 6ms 256.0 KiB
#5 Accepted 5ms 256.0 KiB
#6 Accepted 5ms 256.0 KiB
#7 Accepted 5ms 256.0 KiB
#8 Accepted 5ms 256.0 KiB
#9 Accepted 5ms 256.0 KiB
#10 Accepted 2ms 256.0 KiB

代码

var n,i,max,ans,t,s,sum:longint;
    a,w:array[0..2000]of longint;
begin

 readln(n);
 a[0]:=0;
 for i:=1 to n do begin
  read(t);
  a[i]:=t+a[i-1];
  w[i]:=t;
 end;
 max:=-maxlongint;
 for s:=1 to n do begin
  ans:=0;
  sum:=0;
  for i:=s to n do begin
  ans:=ans+a[i]-a[i-1]+sum;
  sum:=sum+w[i];
  if (ans>max) then max:=ans;
 end;
 end;
 writeln(max);
 close(input);
 close(output);
end.

信息

递交者
类型
递交
题目
奇葩
题目数据
下载
语言
Pascal
递交时间
2017-08-22 14:49:28
评测时间
2017-08-22 14:49:28
评测机
分数
100
总耗时
41ms
峰值内存
256.0 KiB