UVa253

来源:互联网 发布:微策略软件 编辑:程序博客网 时间:2024/06/07 00:42
#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
原创粉丝点击