文件名称:Mysteryproblem
- 所属分类:
- 数学计算/工程计算
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 863kb
- 下载次数:
- 0次
- 提 供 者:
- wak***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
重排九宫是一个古老的单人智力游戏。据说重排九宫起源于我国古时由三国演义故事“关羽义释曹操”而设计的智力玩具“华容道”,后来流传到欧洲,将人物变成 数字。原始的重排九宫问题是这样的:将数字1~8按照任意次序排在3×3的方格阵列中,留下一个空格。与空格相邻的数字,允许从上,下,左,右方向移动到 空格中。游戏的最终目标是通过合法移动,将数字 1~8 按行排好序。在一般情况下,n2-1 谜问题是将数字 1~n2-1 按照任意次序排在n×n的方格阵列中,留下一个空格。允许与空格相邻的数字从上,下,左,右 4个方向移动到空格中。游戏的最终目标是通过合法移动,将初始状态变换到目标状态。
对于给定的n×n方格阵列中数字1~n2-1 初始排列,编程计算将初始排列通过合法移动变换为目标状态最少移动次数。
′数据输入:
文件的第1行有1个正整数n。以下的n行是 n×n方格阵列的中数字1~n2-1的初始排列,每行有n个数字表示该行方格中的数字, 0表示空格。
接着n行是n×n方 格阵列的中数字1~n2-1的目标排列,每行有n个数字表示该行方格中的数字, 0表示空格。1<=n<=10
结果输出:
第 1 行是最少移动次数。-Rearrangement Jiu Gong is an ancient single puzzle. Jiu Gong is said to originate from the rearrangement of China in ancient times by the Three Kingdoms story, "Guan Yu Yi Cao release" designed to intellectual toys "Huarong" and later spread to Europe, will figure into a figure. Jiugong original rearrangement problem is this: will the number 1 to 8 in accordance with any order of ranking, the box in the 3 × 3 array, leaving a space. And the number of adjacent spaces, to allow from the top, bottom, left and right direction to move to the space. The ultimate goal of the game through the legal move, the numbers 1 to 8 lined by row sequence. Under normal circumstances, n2-1 mystery issue is the number 1 ~ n2-1 in accordance with any order of rank n × n array of squares, leaving a space. Permitted number of adjacent spaces from the top, bottom, left and right four directions to move to an empty cell. The ultimate goal of the game through the legal move, transform the initial state to target
对于给定的n×n方格阵列中数字1~n2-1 初始排列,编程计算将初始排列通过合法移动变换为目标状态最少移动次数。
′数据输入:
文件的第1行有1个正整数n。以下的n行是 n×n方格阵列的中数字1~n2-1的初始排列,每行有n个数字表示该行方格中的数字, 0表示空格。
接着n行是n×n方 格阵列的中数字1~n2-1的目标排列,每行有n个数字表示该行方格中的数字, 0表示空格。1<=n<=10
结果输出:
第 1 行是最少移动次数。-Rearrangement Jiu Gong is an ancient single puzzle. Jiu Gong is said to originate from the rearrangement of China in ancient times by the Three Kingdoms story, "Guan Yu Yi Cao release" designed to intellectual toys "Huarong" and later spread to Europe, will figure into a figure. Jiugong original rearrangement problem is this: will the number 1 to 8 in accordance with any order of ranking, the box in the 3 × 3 array, leaving a space. And the number of adjacent spaces, to allow from the top, bottom, left and right direction to move to the space. The ultimate goal of the game through the legal move, the numbers 1 to 8 lined by row sequence. Under normal circumstances, n2-1 mystery issue is the number 1 ~ n2-1 in accordance with any order of rank n × n array of squares, leaving a space. Permitted number of adjacent spaces from the top, bottom, left and right four directions to move to an empty cell. The ultimate goal of the game through the legal move, transform the initial state to target
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Mysteryproblem\Debug\Mysteryproblem.exe
..............\.....\Mysteryproblem.ilk
..............\.....\Mysteryproblem.obj
..............\.....\Mysteryproblem.pch
..............\.....\Mysteryproblem.pdb
..............\.....\vc60.idb
..............\.....\vc60.pdb
..............\Mysteryproblem.cpp
..............\Mysteryproblem.dsp
..............\Mysteryproblem.dsw
..............\Mysteryproblem.ncb
..............\Mysteryproblem.opt
..............\Mysteryproblem.plg
..............\Debug
Mysteryproblem
..............\.....\Mysteryproblem.ilk
..............\.....\Mysteryproblem.obj
..............\.....\Mysteryproblem.pch
..............\.....\Mysteryproblem.pdb
..............\.....\vc60.idb
..............\.....\vc60.pdb
..............\Mysteryproblem.cpp
..............\Mysteryproblem.dsp
..............\Mysteryproblem.dsw
..............\Mysteryproblem.ncb
..............\Mysteryproblem.opt
..............\Mysteryproblem.plg
..............\Debug
Mysteryproblem