uva253 CubePainting
Posted ArvinShaffer
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了uva253 CubePainting相关的知识,希望对你有一定的参考价值。
简单题,总共24中旋转方法,一一列举。
#include<iostream> #include<cstring> using namespace std; int tables[24][6] = { {1,2,3,4,5,6},{1,3,5,2,4,6},{1,4,2,5,3,6},{1,5,4,3,2,6}, {2,1,4,3,6,5},{2,3,1,6,4,5},{2,4,6,1,3,5},{2,6,3,4,1,5}, {3,1,2,5,6,4},{3,2,6,1,5,4},{3,5,1,6,2,4},{3,6,5,2,1,4}, {4,1,5,2,6,3},{4,2,1,6,5,3},{4,5,6,1,2,3},{4,6,2,5,1,3}, {5,1,3,4,6,2},{5,3,6,1,4,2},{5,4,1,6,3,2},{5,6,4,3,1,2}, {6,2,4,3,5,1},{6,3,2,5,4,1},{6,4,5,2,3,1},{6,5,3,4,2,1} }; int main() { char cube[10], rcube[10], str[20]; while (cin >> str) { int i; memset(cube, 0, sizeof(cube)); memset(rcube, 0, sizeof(rcube)); for (i = 0; i < 6; i++) { cube[i] = str[i]; rcube[i] = str[i + 6]; } int flag = 0; for(i = 0;i < 24; i++){ int temp = 1; for(int j=0;j<6;j++){ if(cube[tables[i][j]-1]!=rcube[j]){ temp=0; break; } } if(temp==1){ flag=1; break; } } if(flag)cout<<"TRUE"<<endl; else cout<<"FALSE"<<endl; } return 0; }
以上是关于uva253 CubePainting的主要内容,如果未能解决你的问题,请参考以下文章