比赛 |
noip-081029 |
评测结果 |
WAAAATTTTT |
题目名称 |
取数字问题 |
最终得分 |
40 |
用户昵称 |
zxc111 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-10-29 19:35:25 |
显示代码纯文本
program ooo;
var
i,j,k,n,m,min:longint;
a:array[1..100,1..100] of longint;
t:text;
procedure oo(d,r,o:longint);
var
i,j,k:longint;
begin
if (d=n)and(m=r) then
begin
if (o>0)and(o<min) then min:=o;
exit;
end;
if d+1<=n then oo(d+1,r,o+a[d+1,r]);
if r+1<=m then oo(d,r+1,o+a[d,r+1]);
end;
begin
min:=maxlongint;
assign(t,'number.in');
reset(t);
readln(t,n,m);
for i:=1 to n do
begin
for j:=1 to m do
read(t,a[i,j]);
readln(t);
end;
close(t);
oo(1,1,a[1,1]);
assign(t,'number.out');
rewrite(t);
write(t,min);
close(t);
end.