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题,还算简单,之前做了到一摸一样的,那时用的是DFS

Posted by lzq08ms at 2011-06-04 13:17:37 on Problem 2243
BFS直接一步步走,走到终点就返回,每一个点的步数是之前点的步数+1.
DFS从头搜到底,记录每一个点的最小步数,要知道最大不可能超过6步,8X8的棋盘里最少6步就可以到任意点。每次只要走的部署超过6就停,并且不断更新这个最小步数,一旦走的部署超过当前的最小步数就停止,要不然会TLE.

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