题解:只要保证两个正方体对面的颜色对应就可以了,比如rbgggrrggbgr第一个正方体对面颜色分别是rr bg gg, 第二个正方体对面颜色分别是rr, gg, gb,只要这两组数据都一一对应,字母相同,顺序可以不相同,就是true,否则false.
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
int main() {
string s, str[3], temp, temp1;
int i, flag;
while (getline(cin, s)) {
for (i = 0; i < 3; i++)
str[i] = "";
str[0] += s[0];
str[1] += s[1];
str[2] += s[2];
str[0] += s[5];
str[1] += s[4];
str[2] += s[3];
temp = temp1 = "";
temp += s[6];
temp += s[11];
temp1 += s[11];
temp1 += s[6];
for (i = 0; i < 3; i++)
if (temp == str[i] || temp1 == str[i]) {
str[i] = "\0";
break;
}
if (i == 3) {
printf("FALSE\n");
continue;
}
temp = temp1 = "";
temp += s[7];
temp += s[10];
temp1 += s[10];
temp1 += s[7];
for (i = 0; i < 3; i++)
if (temp1 == str[i] || temp == str[i]) {
str[i] = "\0";
break;
}
if (i == 3) {
printf("FALSE\n");
continue;
}
temp = temp1 = "";
temp += s[8];
temp += s[9];
temp1 += s[9];
temp1 += s[8];
for (i = 0; i < 3; i++)
if (temp1 == str[i] || temp == str[i])
break;
if (i == 3) {
printf("FALSE\n");
continue;
}
printf("TRUE\n");
}
return 0;
}