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

建议使用的浏览器:

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

2953:Rubiks Cube

题目描述
Following the hype generated by Rubiks Cube Norwegian Open Championship arranged at NTNU this year, each and every student at NTNU has bought such a cube. The professors, however, are dismayed, because the students rather play with their cube instead of listening to the professors lectures.


One professor suddenly gets the idea that if he gives the students a program to solve their cubes they may lose interest in it, so that it will be possible to start teaching again. Of course, the professor don't want to do the grunt work of programming, and you are the lucky assignee of this task.


The professor takes away your cube, locks you in a faraway laboratory and says that you won't get out until you have written a program to solve Rubiks cube.


Luckily, the professor did not specify the size of the cube, so you decide to make the work slightly easier by solving the Rubiks 2  2  2 cube.
输入解释
The first line of the input consists of a single number T, the number of test cases. Each test case consists of six lines describing the initial configuration of a cube, formatted exactly as in the example input. The characters used for colors are G, R, O, B, Y and W.

Each test case is followed by an empty line.
输出解释
For each scenario, output a line with the minimum number of moves that is necessecary to solve the cube. A move is turning one face of the cube 90 degrees clockwise or counter-clockwise. (A turn of 180 degrees is considered to be two moves.)

Notes and Constraints
0 < T <= 100
You may assume that all input cubes are scrambled versions of originally solved cubes with six diffierent colors. (Which means there are exactly four occurrences of each color and that it is possible to get the cube to a solved state using moves as described above.)
输入样例
2
OO
OO
RR GG BB WW
RR GG BB WW
YY
YY
RR
RR
YY OO GG BB
OO GG BB YY
WW
WW
输出样例
0
1
来自杭电HDUOJ的附加信息
Recommend gaojie

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

题目来源 IDI Open 2009

源链接: HDU-2953

最后修改于 2020-10-25T22:58:36+00:00 由爬虫自动更新

共提交 0

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