文件名称:turnCoin
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:209.12kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
游戏的规则是,给定一个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/turnCoin.dsp
turnCoin/turnCoin.dsw
turnCoin/turnCoin.ncb
turnCoin/turnCoin.opt
turnCoin/turnCoin.plg
turnCoin/Debug/turnCoin.exe
turnCoin/Debug/turnCoin.ilk
turnCoin/Debug/turnCoin.obj
turnCoin/Debug/turnCoin.pch
turnCoin/Debug/turnCoin.pdb
turnCoin/Debug/vc60.idb
turnCoin/Debug/vc60.pdb
turnCoin/Debug
turnCoin
turnCoin/turnCoin.dsp
turnCoin/turnCoin.dsw
turnCoin/turnCoin.ncb
turnCoin/turnCoin.opt
turnCoin/turnCoin.plg
turnCoin/Debug/turnCoin.exe
turnCoin/Debug/turnCoin.ilk
turnCoin/Debug/turnCoin.obj
turnCoin/Debug/turnCoin.pch
turnCoin/Debug/turnCoin.pdb
turnCoin/Debug/vc60.idb
turnCoin/Debug/vc60.pdb
turnCoin/Debug
turnCoin
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.