Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么是WA呢?不明白啊!高手请指导一下撒!

Posted by hubo430 at 2006-04-19 11:17:21 on Problem 2704
#include<stdio.h>
int main()
{
	int n,i,j,a[34][34],x,y;
	double b[34][34];
	char c;
	while(scanf("%d%*c",&n)==1)
	{
		if(n==-1) break;
		for(i=0;i<n;i++)
		{
			for(j=0;j<n;j++)
			{
				scanf("%c",&c);
				b[i][j]=0.0;
				a[i][j]=c-'0';
			}
			scanf("%*c");
		}
		b[0][0]=1.0;
		for(i=0;i<n;i++)
			for(j=0;j<n;j++)
			{
				if(i==n-1&&j==n-1) break;
				if(a[i][j]==0) {b[i][j]=0;continue;}
				x=i;y=j;
				x+=a[i][j];
				if(x<n) b[x][j]+=b[i][j];
				y+=a[i][j];
				if(y<n) b[i][y]+=b[i][j];
			}
		printf("%.0f\n",b[n-1][n-1]);
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator