比赛 |
NOIP2008集训模拟4 |
评测结果 |
AEAAAEEEEE |
题目名称 |
艾萨拉的激流 |
最终得分 |
40 |
用户昵称 |
chengyang |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-11-13 09:58:54 |
显示代码纯文本
program azshara;
var
a:array[-1..1010,-1..10010]of longint;
w,l,max:longint;
procedure ini;
var
i,j:longint;
Begin
assign(input,'azshara.in');
assign(output,'azshara.out');
reset(input); rewrite(output);
readln(w,l);
for i:=0 to l+1 do begin
for j:=0 to w+1 do a[i,j]:=-1;
end;
for i:=1 to l do begin
for j:=1 to w do read(a[i,j]);
readln;
end;
End;
procedure go;
var
i,j,k:longint;
Begin
for i:=2 to l do begin
for j:= 1 to w do if a[i,j]<>-1 then begin
k:=a[i-1,j];
if a[i-1,j+1]>k then k:=a[i-1,j+1];
if a[i-1,j-1]>k then k:=a[i-1,j-1];
a[i,j]:=k+a[i,j];
end;
end;
max:=a[l,1];
for i:=1 to w do if a[l,i]>max then max:=a[l,i];
End;
Begin
ini;
go;
writeln(max);
close(input); close(output);
End.