- 传纸条
- 2009-10-28 19:59:09 @
var a:array[1..50,1..50] of integer;
f:array[0..100,0..50,0..50] of int64;
i,j,k,n,m:longint;
function max(a,b,c,d:int64):int64;
begin
max:=a;
if b>max then max:=b;
if c>max then max:=c;
if d>max then max:=d;
end;
begin
readln(m,n);
for i:=1 to m do
for j:=1 to n do
read(a);
f[0,1,1]:=a[1,1];
f[1,1,2]:=a[2,1]+a[1,2]; f[1,2,1]:=a[1,2]+a[2,1];
for i:=2 to m+n-3 do
for j:=1 to n do
for k:=1 to n do
if ((jk) or ((j=n) and (k=n))) and (i+2>j) and (i+2>k) then
f:=max(f,f,f,f)+a[j,i+2-j]+a[k,i+2-k];
writeln(f[m+n-3,n,n-1]);
end.
0 条评论
目前还没有评论...