/DAYSO2 - Dãy số 2 (OLPCĐ 2014)

<Problem>

http://ntucoder.net/Problem/Details/125
              Uses Crt,Math;
      Var n,i:longint;
          kq:int64;
          a,t,f:array[-10..1000000] of int64;
      Begin
          readln(n);
          t[0]:=0;
          for i:=1 to n do
           begin
               read(a[i]);
               t[i]:=t[i-1]+a[i];
           end;
          kq:=-maxlongint;
          for i:=3 to n do
           begin
               f[i]:=f[i-3]+(t[i]-t[i-3]);
               kq:=max(kq,f[i]);
               if f[i]<0 then f[i]:=0;
           end;
          writeln(kq);
          readln;
      End.