记录编号 |
8217 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[BYVoid S3] 艾萨拉的激流 |
最终得分 |
100 |
用户昵称 |
zxc111 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
6.238 s |
提交时间 |
2008-11-13 12:08:20 |
内存使用 |
86.13 MiB |
显示代码纯文本
program ooo;
var
i,j,k,n,m,max:longint;
t:text;
a,b:array[0..10001,0..1001] of longint;
f:array[0..10001,0..1001] of boolean;
begin
assign(t,'azshara.in');
reset(t);
readln(t,n,m);
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
fillchar(f,sizeof(f),false);
for i:=1 to m do
begin
for j:=1 to n do
read(t,a[i,j]);
readln(t);
end;
close(t);
for i:=1 to n do
begin
f[1,i]:=true;
b[1,i]:=a[1,i];
end;
for i:=2 to m do
begin
for j:=1 to n do
if (a[i,j]<>-1) then
begin
f[i,j]:=true;
if b[i-1,j]+a[i,j]>b[i,j] then b[i,j]:=b[i-1,j]+a[i,j];
if b[i-1,j-1]+a[i,j]>b[i,j] then b[i,j]:=b[i-1,j-1]+a[i,j];
if b[i-1,j+1]+a[i,j]>b[i,j] then b[i,j]:=b[i-1,j+1]+a[i,j];
end;
end;
max:=0;
for i:=1 to n do
if max<b[m,i] then max:=b[m,i];
assign(t,'azshara.out');
rewrite(t);
write(t,max);
close(t);
end.