Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请高人指点一下,本人用的是广度搜索,测试数据已通过(附上代码)#include "stdio.h" #include "string.h" void main() { int i,j,n; int a[35][35],b[35][35]; scanf("%d",&n); while(n!=-1) { for(i=1;i<=n;i++) for(j=1;j<=n;j++) scanf("%1d",&a[i][j]); memset(b,0,sizeof(b)); b[1][1]=1; for(i=1;i<=n;i++) for(j=1;j<=n;j++) { if(a[i][j]==0) continue; if(a[i][j]+j<=n) b[i][j+a[i][j]]+=b[i][j]; if(a[i][j]+i<=n) b[a[i][j]+i][j]+=b[i][j]; } printf("%d\n",b[n][n]); scanf("%d",&n); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator