文件名称:horse
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:849.98kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
问题描述与实验目的
给定8*8方格棋盘,求棋盘上一只马从一个位置到达另一位置的最短路径长。
注意马是走“日”形的。
输入
输入有若干测试数据。
每组测试数据仅1行,每行上有2个方格pos1、pos2,之间用一个空格隔开,每格方格表示棋盘上的一个位置,该位置由表示列的1个字母(a-h)及表示行的一个数字(1-8)构成,如“d7”表示第4列第7行。
输出
对输入中每行上的2个方格pos1、pos2,输出马从位置pos1跳到pos2所需的最短路径长。如“a1==>a2: 3 moves”表示从位置a1跳到a2所需的最少步数是3。
注意:按输出样例所示格式输出,如“a1==>a2: 3 moves”中冒号后有一个空格,再跟着所需的最少步数。
实验结果
输入样例
a1 a2
a1 a3
a1 h8
g2 b8
输出样例
a1==>a2: 3 moves
a1==>a3: 2 moves
a1==>h8: 6 moves
g2==>b8: 5 moves
-Descr iption and purpose of the experiment
8* 8 grid for a given board, find the board a horse from one location to another location to reach the shortest path length.
Note that horse is to take the "day" shape.
Input
Enter a number of test data.
Only 1 line of each test data, each line has 2 squares pos1, pos2, separated by a space, each grid square, said a board position, the position of column 1 by the said letters ( ah), and that the line of a number (1-8) form, such as "d7" said the line 7 column 4.
Output
Each line in the input box on the two pos1, pos2, output horse to jump from position pos1 pos2 shortest path length required. Such as "a1 ==> a2: 3 moves" that jump from position a1 a2 minimum required number of steps is 3.
Note: The sample shown by the output format of the output, such as "a1 ==> a2: 3 moves" in a space after the colon, and then follow the required minimum number of steps.
Experimental results
Input sample
a1 a2
a1 a3
a1 h8
g2 b8
Sample Ou
给定8*8方格棋盘,求棋盘上一只马从一个位置到达另一位置的最短路径长。
注意马是走“日”形的。
输入
输入有若干测试数据。
每组测试数据仅1行,每行上有2个方格pos1、pos2,之间用一个空格隔开,每格方格表示棋盘上的一个位置,该位置由表示列的1个字母(a-h)及表示行的一个数字(1-8)构成,如“d7”表示第4列第7行。
输出
对输入中每行上的2个方格pos1、pos2,输出马从位置pos1跳到pos2所需的最短路径长。如“a1==>a2: 3 moves”表示从位置a1跳到a2所需的最少步数是3。
注意:按输出样例所示格式输出,如“a1==>a2: 3 moves”中冒号后有一个空格,再跟着所需的最少步数。
实验结果
输入样例
a1 a2
a1 a3
a1 h8
g2 b8
输出样例
a1==>a2: 3 moves
a1==>a3: 2 moves
a1==>h8: 6 moves
g2==>b8: 5 moves
-Descr iption and purpose of the experiment
8* 8 grid for a given board, find the board a horse from one location to another location to reach the shortest path length.
Note that horse is to take the "day" shape.
Input
Enter a number of test data.
Only 1 line of each test data, each line has 2 squares pos1, pos2, separated by a space, each grid square, said a board position, the position of column 1 by the said letters ( ah), and that the line of a number (1-8) form, such as "d7" said the line 7 column 4.
Output
Each line in the input box on the two pos1, pos2, output horse to jump from position pos1 pos2 shortest path length required. Such as "a1 ==> a2: 3 moves" that jump from position a1 a2 minimum required number of steps is 3.
Note: The sample shown by the output format of the output, such as "a1 ==> a2: 3 moves" in a space after the colon, and then follow the required minimum number of steps.
Experimental results
Input sample
a1 a2
a1 a3
a1 h8
g2 b8
Sample Ou
(系统自动生成,下载前可以参看下载内容)
下载文件列表
horse/horse.dsw
horse/horse.ncb
horse/horse.plg
horse/horse.dsp
horse/horse.cpp
horse/Debug/vc60.idb
horse/Debug/vc60.pdb
horse/Debug/horse.pch
horse/Debug/horse.exe
horse/Debug/horse.pdb
horse/Debug/horse.obj
horse/Debug/horse.ilk
horse/horse.opt
horse/Debug
horse
horse/horse.ncb
horse/horse.plg
horse/horse.dsp
horse/horse.cpp
horse/Debug/vc60.idb
horse/Debug/vc60.pdb
horse/Debug/horse.pch
horse/Debug/horse.exe
horse/Debug/horse.pdb
horse/Debug/horse.obj
horse/Debug/horse.ilk
horse/horse.opt
horse/Debug
horse
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.