language: Pascal (gpc) (gpc 20070904)
date: 104 days 18 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
program dyskol(input,output);
 type list = 0..1000000;
 var N, i, j, max : list; sum : array[1..10000,1..10000] of integer; a : array[1..1000000] of integer;
Begin
 readln(N);
 i := 0;
 while not eoln do
 begin
  i := i + 1;
  read(a[i])
 end;
 readln;
 max := 0;
 for i := 1 to N-1 do
  for j := i + 1 to N do
   sum[i,j] := 0;
 for i := 1 to N-1 do
  for j := i + 1 to N do
  begin
   sum[i,j] := sum[i,j] + a[i] + a[j];
   if max < sum[i,j] then max := sum[i,j]
  end;
 writeln(max)
End.