讨论 / PASCAL 递推
1233211234567 2012-07-06 20:14:00
点我顶贴 收藏 删除
状态: Accepted

测评机: Xeost[5]

得分: 100分 [我要评价一下题目~]

提交日期: 2012-7-7 11:01:00

有效耗时: 1547毫秒

测试结果1: 通过本测试点|有效耗时172ms

测试结果2: 通过本测试点|有效耗时172ms

测试结果3: 通过本测试点|有效耗时156ms

测试结果4: 通过本测试点|有效耗时172ms

测试结果5: 通过本测试点|有效耗时156ms

测试结果6: 通过本测试点|有效耗时156ms

测试结果7: 通过本测试点|有效耗时172ms

测试结果8: 通过本测试点|有效耗时172ms

测试结果9: 通过本测试点|有效耗时63ms

测试结果10: 通过本测试点|有效耗时156ms

提交代码: view sourceprint?

var

n:longint;

f:array[0..21,0..21]of longint;

a:array[0..21,0..21]of longint;

procedure init;

var i,j:longint;

begin

readln(n);

fillchar(f,sizeof(f),0);

fillchar(a,sizeof(a),0);

for i:=1 to n do

for j:=1 to n do read(a[i,j]);

if a[1,1]=1 then begin writeln('0');halt;end;

end;

procedure work;

var i,j:longint;

begin

f[1,1]:=1;

for i:=2 to n do

if a[i,1]=0 then f[i,1]:=f[i-1,1];

for j:=2 to n do

if a[1,j]=0 then f[1,j]:=f[1,j-1];

for i:=2 to n do

for j:=2 to n do

if a[i,j]=0 then f[i,j]:=f[i-1,j]+f[i,j-1];

end;

procedure ouit;

begin

writeln(f[n,n]);

end;

begin

init;

work;

ouit;

end.

搜索搜了总不过,谁过了发上来!

查看更多回复
提交回复