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

明显你的BFS有问题,别人的都有两个while语句.

Posted by level at 2007-02-16 20:07:14 on Problem 2251
In Reply To:高手看一下,我的BFS哪错了??我的测试数据都对呀!!! Posted by:byron at 2006-07-12 21:07:04
> 		while(front<=rear)!!!!!!!!!!!!!
> 		{!!!!!!!!!!!!!!!!!!!!!!!!!!!
> 			now.x=queue[front].x;
> 			now.y=queue[front].y;
> 			now.z=queue[front].z;
> 			count++;
> 			for(v=1;v<=6;v++)
> 			{
> 				next.x=now.x+move[v].x;
> 				next.y=now.y+move[v].y;
> 				next.z=now.z+move[v].z;
> 				if(!maze[next.x][next.y][next.z])
> 				{
> 					rear++;
> 					queue[rear].x=next.x;
> 					queue[rear].y=next.y;
> 					queue[rear].z=next.z;
> 					maze[next.x][next.y][next.z]=1;
> 					if(next.x==end.x && next.y==end.y && next.z==end.z)	
> 					{
> 						count--;
> 						goto	LL;
> 					}
> 				}
> 			}
> 			front++;
> 		}
> 
> 		if(front>rear)
> 			printf("Trapped!\n");
> 		else
> LL:			printf("Escaped in %d minute(s).\n",count);
> 		scanf("%d%d%d",&L,&R,&C);
> 	}
> }

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