- 能量项链
- 2009-10-30 21:36:56 @
program energy(input,output);
var
a,d:array[1..300]of longint;
b,c:array[1..300,1..300]of longint;
max,i,j,n,k,u,mls:longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
begin
d:=a;
fillchar(b,sizeof(b),0);
for j:=n+1 to i+n-1 do
a[j]:=a[j-n];
a:=a[i];
for j:=i to i+n-2 do
b[j,j+1]:=a[j]*a[j+1]*a[j+2];
b:=a*a[i]*a;
for k:=i+2 to i+n-1 do
begin
max:=b;
for u:=i+1 to k do
begin
mls:=b+b+a[i]*a[k+1]*a;
if mls>max
then max:=mls;
end;
b:=max;
end;
c:=b;
a:=d;
end;
max:=0;
for i:=1 to n do
if c>max
then max:=c;
writeln(max);
end.
0 条评论
目前还没有评论...