CDN加速镜像 | 设为首页 | 加入收藏夹
当前位置: 首页 资源下载 源码下载 数值算法/人工智能

文件名称: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/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

相关说明

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

相关评论

暂无评论内容.

发表评论

*快速评论: 推荐 一般 有密码 和说明不符 不是源码或资料 文件不全 不能解压 纯粹是垃圾
*内  容:
*验 证 码:
搜珍网 www.dssz.com