文件名称:turnCoin
- 所属分类:
- 数值算法/人工智能
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 209kb
- 下载次数:
- 1次
- 提 供 者:
- 小*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
游戏的规则是,给定一个4×4 的棋盘,每个格子放上一枚硬币,
可能是正面朝上,也可能是反面朝上。如果要翻转其中的一枚硬币,与它相邻的上下左右
的硬币如果存在,也必须同时翻转,合起来称为一次翻转。现在给出棋盘上硬币的初始放
置状态和目标放置状态,请计算,最少需要多少次翻转才能将棋盘上的硬币从初始放置状
态转化为目标放置状态。
Input:输入的第一行含一个正整数k,表示测试例组数。下面紧接着k 组测试例的数据。
每组包含两个4×4 的0﹣1 阵列,用一个空行分隔,分别表示棋盘的初始放置状态和目标放
置状态。同一行的数据之间用一个空格隔开,两组测试例之间用一个空行隔开。
Output:对应每个测试例输出一个整数,表示最少翻转次数,如果无解,则输出-1。一个
整数占一行。-Rules of the game is given a 4 × 4 chessboard, put a coin for each grid,
May be right side up, it could be negative up. If you want to flip a coin which, with its adjacent up and down
Coins if present, must also flip, collectively referred to as a flip. Now the board is given the initial release of coins
Home state and target placement status, calculation, at least how many times can flip a coin on the board-like from the initial placement
State into a goal of placing state.
Input: Enter the first line containing a positive integer k, the number of said groups of test cases. Then the following set of test cases k data.
Each group consists of two 4 × 4 array of 0-1, separated by a blank line, respectively, the board said the initial goal of placing state and put
Home state. Data in the same line separated by a space between the two groups of test cases separated by a blank line between.
Output: corresponding to each test case output an integer that represents the least n
可能是正面朝上,也可能是反面朝上。如果要翻转其中的一枚硬币,与它相邻的上下左右
的硬币如果存在,也必须同时翻转,合起来称为一次翻转。现在给出棋盘上硬币的初始放
置状态和目标放置状态,请计算,最少需要多少次翻转才能将棋盘上的硬币从初始放置状
态转化为目标放置状态。
Input:输入的第一行含一个正整数k,表示测试例组数。下面紧接着k 组测试例的数据。
每组包含两个4×4 的0﹣1 阵列,用一个空行分隔,分别表示棋盘的初始放置状态和目标放
置状态。同一行的数据之间用一个空格隔开,两组测试例之间用一个空行隔开。
Output:对应每个测试例输出一个整数,表示最少翻转次数,如果无解,则输出-1。一个
整数占一行。-Rules of the game is given a 4 × 4 chessboard, put a coin for each grid,
May be right side up, it could be negative up. If you want to flip a coin which, with its adjacent up and down
Coins if present, must also flip, collectively referred to as a flip. Now the board is given the initial release of coins
Home state and target placement status, calculation, at least how many times can flip a coin on the board-like from the initial placement
State into a goal of placing state.
Input: Enter the first line containing a positive integer k, the number of said groups of test cases. Then the following set of test cases k data.
Each group consists of two 4 × 4 array of 0-1, separated by a blank line, respectively, the board said the initial goal of placing state and put
Home state. Data in the same line separated by a space between the two groups of test cases separated by a blank line between.
Output: corresponding to each test case output an integer that represents the least n
(系统自动生成,下载前可以参看下载内容)
下载文件列表
turnCoin\turnCoin.cpp
........\turnCoin.dsp
........\turnCoin.dsw
........\turnCoin.ncb
........\turnCoin.opt
........\turnCoin.plg
........\Debug\turnCoin.exe
........\.....\turnCoin.ilk
........\.....\turnCoin.obj
........\.....\turnCoin.pch
........\.....\turnCoin.pdb
........\.....\vc60.idb
........\.....\vc60.pdb
........\Debug
turnCoin
........\turnCoin.dsp
........\turnCoin.dsw
........\turnCoin.ncb
........\turnCoin.opt
........\turnCoin.plg
........\Debug\turnCoin.exe
........\.....\turnCoin.ilk
........\.....\turnCoin.obj
........\.....\turnCoin.pch
........\.....\turnCoin.pdb
........\.....\vc60.idb
........\.....\vc60.pdb
........\Debug
turnCoin