自己弄了20组数据都对了 -_- ...
评测 只得 20分?!
var n,i,j:longint;
a:array[1..20,1..20]of longint;
begin
readln(n);
for i:=1 to n do
begin for j:=1 to n do
begin read(a[i,j]);
if a[i,j]=1 then a[i,j]:=-1;
if ((i=1) or (j=1))and(a[i,j]<>-1)
then a[i,j]:=1
else if a[i,j]<>-1 then a[i,j]:=a[i-1,j]+a[i,j-1]
else a[i,j]:=0;
end; readln;
end;
writeln(a[n,n]);
end.
var
n,i,j:integer;
a:array[0..20,0..20]of longint;
begin
read(n);
for i:=1 to n do
for j:=1 to n do begin
read(a[i,j]);
if a[i,j]=1 then a[i,j]:=-1;
end;
a[1,1]:=1;
for i:=1 to n do
for j:=1 to n do if a[i,j]<>-1 then
begin
if (a[i-1,j]=-1) and (a[i,j-1]<>-1) then inc(a[i,j],a[i,j-1]);
if (a[i-1,j]<>-1) and (a[i,j-1]=-1) then inc(a[i,j],a[i-1,j]);
if (a[i-1,j]<>-1) and (a[i,j-1]<>-1) then inc(a[i,j],a[i,j-1]+a[i-1,j]);
end;
writeln(a[n,n]);
end.
这是我的,都过了。
测评机: Virmain[1]
得分: 100分
提交日期: 2008-7-6 11:14:00
有效耗时: 该状态没有记录
测试结果1: 测试结果正确
测试结果2: 测试结果正确
测试结果3: 测试结果正确
测试结果4: 测试结果正确
测试结果5: 测试结果正确
测试结果6: 测试结果正确
测试结果7: 测试结果正确
测试结果8: 测试结果正确
测试结果9: 测试结果正确
测试结果10: 测试结果正确
第一行、第一列你是这样处理的:是0则为1,是1则为0。
但是,这样做是不对的。
试想第一行是这样:0 0 0 1 0 0
最右边两个格子能走到吗?
希望你能看懂。