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> struct node { int row; int col; }sq[2048]; int front,rear,x,y,t,n,tag[35][35]; __int64 f[35][35]; int map[35][35]; void count() { memset(f,0,sizeof(f)); memset(tag,0,sizeof(tag)); front=0; rear=1; f[1][1]=1; sq[rear].row=1; sq[rear].col=1; while(front<rear) { front++; x=sq[front].row; y=sq[front].col; if((t=y+map[x-1][y-1])<=n) { f[x][t]+=f[x][y]; if(!tag[x][t]&&!(x==n&&t==n)) { rear++; sq[rear].row=x; sq[rear].col=t; tag[x][t]=1; } } if((t=x+map[x-1][y-1])<=n) { f[t][y]+=f[x][y]; if(!tag[t][y]&&!(t==n&&y==n)) { rear++; sq[rear].row=t; sq[rear].col=y; tag[t][y]=1; } } } } int main() { int i,j; while(scanf("%d",&n)&&n!=-1) { for(i=0;i<n;i++) { for(j=0;j<n;j++) { scanf("%1d",&map[i][j]); } } count(); printf("%I64d\n",f[n][n]); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator