zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    Linux安装和配置java
    动态代理:JDK动态代理和CGLIB代理的区别
    常用算法复习
    Linux重新学习
    oracle复杂查询是sql
    oracle触发器
    oracle存储过程
    oracle数据库操作
    java知识回顾
    Spring AOP简述
  • 原文地址:https://www.cnblogs.com/ArvinShaffer/p/9032084.html
Copyright © 2011-2022 走看看