当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3278:Puzzle

题目描述
  One day, Resty gets a very interesting puzzle. Eve said that she will make a cake for Resty if he solved this puzzle, so Resty asks you to help him to solve the puzzle as soon as possible.
  As the figure, the puzzle is a rectangle divided into 4 * 6 = 24 squares. Each cell has a color of white / black/ grey. There are exactly 8 cells of each color. Our purpose is to make the middle 8 cells(which are not on the edge) have the same color by minimal steps.

Each step, you could choose a row or a column to shift it for 1 bit. As following:

Now, given the puzzle, you should help Resty find the minimal steps he must use to solve it.
输入解释
The first line is a number T, the number of test case.
Each case contains 4 lines, each line contains a 6-length string, describe a puzzle. B for black color, W for white and G for grey.
输出解释
For each test, output on line in the Format “Case ID: ANS”, ANS should be the minimal number of steps to solve the puzzle.
输入样例
3
GWGGWW
BBBBBW
GBBBGW
WGGGWW
GWGGWW
BWBBBB
GBBBGW
WGGGWW
WWWWWW
BGGGGB
WGGGGW
BBBBBB
输出样例
Case 1: 2
Case 2: 3
Case 3: 0
来自杭电HDUOJ的附加信息
Author Resty
Recommend chenheng

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3278

最后修改于 2020-10-25T23:01:54+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 32768/32768K(Java/Others)