UVa253

#pragma warning(disable:4996)
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>
#include<time.h>
#include<map> 
#include<set>
#include<sstream>
#include<cassert>

using namespace std;
const int INF = 0x3f3f3f3f;

int cube[6][4] = { { 2,4,5,3 },{ 6,4,1,3 },{ 6,2,1,5 },{ 6,5,1,2 },{ 6,3,1,4 },{ 5,4,2,3 } };
int temp[6] = { 6,5,4,3,2,1 };
void judge(string str1, string str2)
{
    int flag = 0;
    int sum;
    for (int i = 0;i < 6;i++)
    {
        for (int k = 0;k <= 3;k++)
        {
            sum = 0;
            for (int j = 0;j < 4;j++)
            {
                if ((str1[cube[0][j] - 1] == str2[(cube[i][(j + k) % 4]) - 1]))
                    sum++;
            }
            if (sum == 4)
                break;
        }
        if (sum == 4 && (str1[0] == str2[i] && str1[temp[0] - 1] == str2[temp[i] - 1]))
            flag = 1;
    }
    if (flag)
        cout << "TRUE" << endl;
    else
        cout << "FALSE" << endl;
}

int main()
{
    string str;
    string str1, str2;
    while (cin >> str)
    {
        str1 = str.substr(0, 6);
        str2 = str.substr(6, 6);
        judge(str1, str2);
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值