比赛 |
noip-081029 |
评测结果 |
AWAAAEEEEE |
题目名称 |
取数字问题 |
最终得分 |
40 |
用户昵称 |
NickName |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-10-29 21:11:01 |
显示代码纯文本
program number;
var ar:array[1..10,1..10] of integer;
ni,no:text;
m,n:longint;
x1,x2:longint;
f:array[1..10,1..10] of longint;
procedure arrive(a,b:longint);
begin
if (a>1) and (b>1) then
if f[a-1,b]<f[a,b-1] then
f[a,b]:=f[a-1,b]+ar[a,b]
else
f[a,b]:=f[a,b-1]+ar[a,b];
if (a=1) and (b>1) then
f[a,b]:=f[a,b-1]+ar[a,b];
if (a>1) and (b=1) then
f[a,b]:=f[a-1,b]+ar[a,b];
if (a=1) and (b=1) then
f[a,b]:=ar[1,1];
end;
begin
assign(ni,'number.in');
reset(ni);
readln(ni,m,n);
for x1:=1 to 10 do
for x2:=1 to 10 do
f[x1,x2]:=-11;
for x1:=1 to m do
begin
for x2:=1 to n do
read(ni,ar[x1,x2]);
readln(ni);
end;
close(ni);
for x1:=1 to m do
for x2:=1 to n do
arrive(x1,x2);
assign(no,'number.out');
rewrite(no);
writeln(no,f[m,n]);
close(no);
end.