记录编号 |
8237 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[BYVoid S3] 艾萨拉的激流 |
最终得分 |
100 |
用户昵称 |
MayLava |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
5.040 s |
提交时间 |
2008-11-13 12:34:36 |
内存使用 |
38.33 MiB |
显示代码纯文本
program MayLava;
const
INF=maxlongint;
var
map:array[1..10000,0..1001]of longint;
w,l:longint;
procedure start;
var
f:text;
i,j:longint;
begin
fillchar(map,sizeof(map),0);
assign(f,'azshara.in');
reset(f);
readln(f,w,l);
for i:=1 to l do begin
for j:=1 to w do
read(f,map[i,j]);
readln(f);
end;
close(f);
end;
function max(a,b,c:longint):longint;
var
m:longint;
begin
m:=0;
if a>m then m:=a;
if b>m then m:=b;
if c>m then m:=c;
exit(m);
end;
procedure main;
var
i,j:longint;
begin
for i:=(l-1) downto 1 do begin
for j:=1 to w do
if map[i,j]<>-1 then map[i,j]:=map[i,j]+max(map[i+1,j+1],map[i+1,j],map[i+1,j-1]);
end;
end;
procedure print;
var
m,i:longint;
f:text;
begin
m:=0;
for i:=1 to w do
if map[1,i]>m then m:=map[1,i];
assign(f,'azshara.out');
rewrite(f);
writeln(f,m);
close(f);
end;
BEGIN
start;
main;
print;
END.