文件名称:knight
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:861.49kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
在一个n*n个方格的国际象棋棋盘上,马(骑士)从任意指定方格出发,按照横1 步竖2 步,或横2 步竖1步的跳马规则,走遍棋盘的每一个格子,且每个格子只走1次。这样的跳马步骤称为1 个成功的骑士征途。例如,当n=5 时的1 个成功的骑士征途如下图所示。
1 2 3 4 5
1 25 14 1 8 19
2 4 9 18 13 2
3 15 24 3 20 7
4 10 5 22 17 12
5 23 16 11 6 21
算法设计:
对于给定的n和n*n方格的起始位置x和y。用分支限界法找出从指定的方格(x,y)出发的一条成功的骑士征途。
数据输入:
第一行有1 个正整数n (1≤n≤10);第二行有2 个正整
数x 和y,表示骑士的起始位置为(x,y)。
结果输出:
如果不存在从(x,y)出发的成功的骑士征途则输出’No Solution!’。
输入:
5
1 3
输出
25 14 1 8 19
4 9 18 13 2
15 24 3 20 7
10 5 22 17 12
23 16 11 6 21-In an n* n squares on the chess board, horse (knight) starting from any given square, erected in accordance with step 1 step 2 horizontal, vertical or horizontal-step 1 step 2 vault rules, traveled to every board lattice, and each grid only take 1. This step is called a successful vault knights journey. For example, when n = 5 when a successful knight journey as shown below.
12345
125,141,819
24,918,132
315,243,207
4105221712
5231611621
Algorithm Design:
For a given n and n* n grid starting position of the x and y. Using branch and bound method to find out from the specified grid (x, y) starting a successful journey Knight.
Data entry:
The first line has a positive integer n (1 ≤ n ≤ 10) the second line has two positive integers
Number of x and y, said Cleveland s starting position (x, y).
The resulting output:
If not from the (x, y) the success of the Knights start the journey is the output No Solution! .
Input:
5
13
Export
25,141,819
4918132
1 2 3 4 5
1 25 14 1 8 19
2 4 9 18 13 2
3 15 24 3 20 7
4 10 5 22 17 12
5 23 16 11 6 21
算法设计:
对于给定的n和n*n方格的起始位置x和y。用分支限界法找出从指定的方格(x,y)出发的一条成功的骑士征途。
数据输入:
第一行有1 个正整数n (1≤n≤10);第二行有2 个正整
数x 和y,表示骑士的起始位置为(x,y)。
结果输出:
如果不存在从(x,y)出发的成功的骑士征途则输出’No Solution!’。
输入:
5
1 3
输出
25 14 1 8 19
4 9 18 13 2
15 24 3 20 7
10 5 22 17 12
23 16 11 6 21-In an n* n squares on the chess board, horse (knight) starting from any given square, erected in accordance with step 1 step 2 horizontal, vertical or horizontal-step 1 step 2 vault rules, traveled to every board lattice, and each grid only take 1. This step is called a successful vault knights journey. For example, when n = 5 when a successful knight journey as shown below.
12345
125,141,819
24,918,132
315,243,207
4105221712
5231611621
Algorithm Design:
For a given n and n* n grid starting position of the x and y. Using branch and bound method to find out from the specified grid (x, y) starting a successful journey Knight.
Data entry:
The first line has a positive integer n (1 ≤ n ≤ 10) the second line has two positive integers
Number of x and y, said Cleveland s starting position (x, y).
The resulting output:
If not from the (x, y) the success of the Knights start the journey is the output No Solution! .
Input:
5
13
Export
25,141,819
4918132
相关搜索: knight.r
(系统自动生成,下载前可以参看下载内容)
下载文件列表
knight/Debug/knight.exe
knight/Debug/knight.ilk
knight/Debug/knight.obj
knight/Debug/knight.pch
knight/Debug/knight.pdb
knight/Debug/vc60.idb
knight/Debug/vc60.pdb
knight/knight.cpp
knight/knight.dsp
knight/knight.dsw
knight/knight.ncb
knight/knight.opt
knight/knight.plg
knight/Debug
knight
knight/Debug/knight.ilk
knight/Debug/knight.obj
knight/Debug/knight.pch
knight/Debug/knight.pdb
knight/Debug/vc60.idb
knight/Debug/vc60.pdb
knight/knight.cpp
knight/knight.dsp
knight/knight.dsw
knight/knight.ncb
knight/knight.opt
knight/knight.plg
knight/Debug
knight
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.