文件名称:turnCoin

介绍说明--下载内容均来自于网络,请自行研究使用

游戏的规则是,给定一个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
(系统自动生成,下载前可以参看下载内容)

下载文件列表

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

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org