-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04. UVa - 253 Cube painting.cpp
54 lines (53 loc) · 1.05 KB
/
04. UVa - 253 Cube painting.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
using namespace std;
char s[12];
bool res(){
for(int i=0;i<6;i++){
if(s[i]!=s[i+6]){
return false;
}
}
return true;
}
void RotateA(){
int temp=s[0];
s[0]=s[1];
s[1]=s[5];
s[5]=s[4];
s[4]=temp;
}
void RotateB(){
int temp=s[1];
s[1]=s[3];
s[3]=s[4];
s[4]=s[2];
s[2]=temp;
}
int main()
{
while(scanf("%s\n",s)!=EOF){
bool result;
for(int i=0;i<6;i++){
result=res();
if(result) break;
else if(i<4) RotateA();
else if(i==4){
RotateB();
RotateA();
}
else if(i==5){
RotateA();
RotateA();
}
for(int j=0;j<4;j++){
result=res();
if(result) break;
RotateB();
}
if(result) break;
}
if(result) printf("TRUE\n");
else printf("FALSE\n");
}
return 0;
}