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

runtime error请高人指点(代码)

Posted by CULT at 2006-02-03 17:51:33 on Problem 2704
#include<stdio.h>
#include<iostream>

using namespace std;

int main()
{
	_int64 steps[34][34];
	int i,j,
		board[34][34],
		n;

	while(cin >> n && n!=-1)
	{

		for(i=0;i<n;i++)
		{
			for(j=0;j<n;j++)
			{
				cin>>board[i][j];
				steps[i][j]=0;
			}
		}
		
		steps[0][0]=1;

		for(i=0;i<n;i++)
		{
			for(j=0;j<n;j++)
			{
				if(steps[i][j]!=0&&board[i][j]!=0)
				{
					if(i+board[i][j]<n)
						steps[i+board[i][j]][j]+=steps[i][j];
					if(j+board[i][j]<n)
						steps[i][j+board[i][j]]+=steps[i][j];
				}
				
			}
		}	

		printf("%I64d\n",steps[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