HDU 5292 Pocket Cube
来源:互联网 发布:域名备案需要哪些资料 编辑:程序博客网 时间:2024/05/01 08:15
Pocket Cube
Problem Description
Pocket Cube is the 2×2×2 equivalent of a Rubik’s Cube(3×3×3). The cube consists of 8 pieces, all corners. (from wiki)
The right position rotates in red face clockwisely.
You can get more details from input case.
w represents white , y represents yellow , o represents orange , r represents red , g represents green , b represents blue. In the right position, white and yellow , orange and red , green and blue are in the opposite face.
The right position rotates in red face clockwisely.
You can get more details from input case.
w represents white , y represents yellow , o represents orange , r represents red , g represents green , b represents blue. In the right position, white and yellow , orange and red , green and blue are in the opposite face.
Input
The first line of input contains only one integer T(<=10000), the number of test cases.
Each case contains a Pocket Cube described above. After each case , there is a blacnk line. It guarantees that the corners of the Cube is right.
Each case contains a Pocket Cube described above. After each case , there is a blacnk line. It guarantees that the corners of the Cube is right.
Output
Each case contains only one line. Each line should start with “Case #i: ”,with i implying the case number, followed by “YES” or “NO”,”YES” means you can return it to the right position, otherwise “NO”.
Sample Input
2 g y g y o o w g r r o o w g r r b w b w y b y b r w g b b y o w o r y g y o g b r w o y b r w g
Sample Output
Case #1: YESCase #2: NO
/* * 二阶魔方任何一个块都可以旋转,这里考虑对色面,(黄,白), (绿, 蓝), (红, 橙) * 将标准魔方展开 * 0 0 * 0 0 * 1 -1 1 -1 1 -1 * -1 1 -1 1 -1 1 * 0 0 * 0 0 * 1 -1 * -1 1 * 只要考虑一组对立面即可,比如(黄, 白),对应到上述展开后,只要最后总和模三等于零就是合理的 */
#include <bits/stdc++.h>#define endl "\n"using namespace std;const int cube[] = {0, 0, 0, 0, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 0, 0, 0, 0, 1, -1, -1, 1};int main() { int T; cin >> T; for(int cas = 1; cas <= T; ++cas) { char color[2]; int ret = 0; for(int i = 0; i < 24; ++i) { scanf("%s", color); if(color[0] == 'w' || color[0] == 'y') ret += cube[i]; } cout << "Case #" << cas << ": " << (ret % 3 ? "NO" : "YES") << endl; } return 0;}
0 0
- HDU 5292 Pocket Cube
- hdu 5292 Pocket Cube
- hdu 5292 Pocket Cube
- hdu 5292 Pocket Cube
- HDU 5292 Pocket Cube
- hdu 4801 Pocket Cube
- hdu 5983 Pocket Cube
- HDU 4801 Pocket Cube
- Pocket Cube HDU
- HDU 5983Pocket Cube
- HDU 4801 Pocket Cube BFS
- HDU 4801 Pocket Cube bfs
- [模拟]HDU 5983 Pocket Cube
- hdu 5983 Pocket Cube(模拟)
- 【HDU 5983 Pocket Cube】& 模拟
- HDU 5983 Pocket Cube 模拟
- HDU 5983 Pocket Cube (模拟)
- 2015 Multi-University Training Contest 1 Hdu 5292 Pocket Cube
- caffe安装以及LeNet初体验
- tensorflow18《TensorFlow实战Google深度学习框架》笔记-08-03 SKlearn封装例子 code
- 2017年实习生面试题(Java研发工程师)
- 在逆转数组中寻找最小元素——Java实现
- 综合指数评价
- HDU 5292 Pocket Cube
- openssh-server
- CSS3之animation、transition
- Core Animation1-简介
- 深入理解java垃圾回收机制
- Android开发,eclipse常用命令
- Linux系统下安装Python以及搭建科学计算(机器学习)环境(anaconda和spyder)
- POJ-2976-01分数规划,二分
- 关于webview的使用