讨论 / 迷宫路径 只得 20分?!
Cloud 2012-02-10 06:19:00
点我顶贴 收藏 删除
怎么错的???

自己弄了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.

#1 冬日的雪花@2008-07-04 20:50:00
回复 删除
program winter;

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.

这是我的,都过了。

#2 Cloud@2008-07-04 20:55:00
回复 删除
我知道错误的原因 ...
#3 Cloud@2008-07-04 20:55:00
回复 删除
我 想 知道错误的原因 ...
#4 白睿测试@2008-07-04 22:58:00
回复 删除
是不是有高精度
#5 binarie@2008-07-04 23:07:00
回复 删除
不知道为啥错...

这题用不上高精度的..一个dp就ok

#6 binarie@2008-07-05 00:16:00
回复 删除
e..

代码看得头疼

话说rq应该改进下文字过滤的代码...

保留前面的缩进多好..

#7 lyyztt67@2008-07-05 20:15:00
回复 删除
状态: Accepted

测评机: Virmain[1]

得分: 100分

提交日期: 2008-7-6 11:14:00

有效耗时: 该状态没有记录

测试结果1: 测试结果正确

测试结果2: 测试结果正确

测试结果3: 测试结果正确

测试结果4: 测试结果正确

测试结果5: 测试结果正确

测试结果6: 测试结果正确

测试结果7: 测试结果正确

测试结果8: 测试结果正确

测试结果9: 测试结果正确

测试结果10: 测试结果正确

#8 Cloud@2008-07-08 18:09:00
回复 删除
到底怎么错了?

晕~~~

#9 Aaron_Kaka@2008-07-09 02:54:00
回复 删除
我来告诉你你为什么错了吧:

第一行、第一列你是这样处理的:是0则为1,是1则为0。

但是,这样做是不对的。

试想第一行是这样:0 0 0 1 0 0

最右边两个格子能走到吗?

希望你能看懂。

#10 zszth@2012-02-10 06:19:00
回复 删除
回复 地核Aaron_Kaka 的帖子

谢谢您提醒

下次一定要小心,不要犯这类错误

查看更多回复
提交回复