文件名称:ma2
-
所属分类:
- 标签属性:
- 上传时间:2014-04-09
-
文件大小:787byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
显然求解骑士游历问题的每一步就是马在棋盘上走的一步。在每一步马需要选择一个方向进行游历,这时记住解的每一步需要记住两件事:
1.当前步的行列位置
2.当前步已经试探过哪些方向了,以便回溯回来时能够选择一个新的方向进行试探
所以使用两个数组,数组board记住棋盘的每个位置是在马的第几步到达的,这反映了问题的解,即第几步到哪个位置。数组direction记住在棋盘的某个位置已经试探过的方向,每个位置有八个方向,可按某种顺序对八个方向编号,然后在每个位置按编号顺序试探方向。 -Obviously the problem solving Knight traveled horse every step is a step on the board walk. At each step the horse needs to select a direction of travel, then the solution every step of the need to remember two things to remember: 1 current position Step 2 ranks the current step has sounded what direction, and come back when you can choose to back A new direction so that the use of two probe arrays, each array board remember the position of the board at the arrival of the horse steps, which reflects the solution of the problem, i.e., the position to which the first few steps. Remember array direction at a certain position of the board has been sounded in the direction of each location has eight directions, according to a certain order of eight directions number, then press the number sequence tentative direction at each location.
1.当前步的行列位置
2.当前步已经试探过哪些方向了,以便回溯回来时能够选择一个新的方向进行试探
所以使用两个数组,数组board记住棋盘的每个位置是在马的第几步到达的,这反映了问题的解,即第几步到哪个位置。数组direction记住在棋盘的某个位置已经试探过的方向,每个位置有八个方向,可按某种顺序对八个方向编号,然后在每个位置按编号顺序试探方向。 -Obviously the problem solving Knight traveled horse every step is a step on the board walk. At each step the horse needs to select a direction of travel, then the solution every step of the need to remember two things to remember: 1 current position Step 2 ranks the current step has sounded what direction, and come back when you can choose to back A new direction so that the use of two probe arrays, each array board remember the position of the board at the arrival of the horse steps, which reflects the solution of the problem, i.e., the position to which the first few steps. Remember array direction at a certain position of the board has been sounded in the direction of each location has eight directions, according to a certain order of eight directions number, then press the number sequence tentative direction at each location.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ma2.cpp
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.