#include
#include
using namespace std;
static int A[4];
static int B[4];
static int C[4];
static int D[4];
static int E[4];
static int F[4];
#define GREEN 1
#define WHITE 2
#define ORANGE 3
#define RED 4
#define YELLOW 5
#define BLUE 6
string get_color(int id) //获取颜色
{
switch (id)
{
case GREEN:
return "绿";
case WHITE:
return "白";
case ORANGE:
return "橙";
case RED:
return "红";
case YELLOW:
return "黄";
case BLUE:
return "蓝";
}
}
void init() //初始状态颜色
{
for (int i = 0;i < 4;i++)
{
A[i] = GREEN;
B[i] = WHITE;
C[i] = ORANGE;
D[i] = RED;
E[i] = YELLOW;
F[i] = BLUE;
}
}
void x_rotate() //在x方向上进行旋转
{
int t1 = A[0];
int t2 = 0;
A[0] = A[2];
A[2] = A[3];
A[3] = A[1];
A[1] = t1;
t1 = E[0];
t2 = E[1];
E[0] = D[3];
E[1] = D[2];
D[2] = B[2];
D[3] = B[3];
B[2] = C[2];
B[3] = C[3];
C[2] = t2;
C[3] = t1;
return;
}
void y_rotate() //在y放上进行旋转
{
int t1 = D[0];
int t2 = 0;
D[0] = D[2];
D[2] = D[3];
D[3] = D[1];
D[1] = t1;
t1 = F[1];
t2 = F[3];
F[1] = B[1];
F[3] = B[3];
B[1] = A[1];
B[3] = A[3];
A[1] = E[1];
A[3] = E[3];
E[1] = t1;
E[3] = t2;
return;
}
void z_rotate() //在z方向上进行旋转
{
int t1 = B[0];
int t2 = 0;
B[0] = B[2];
B[2] = B[3];
B[3] = B[1];
B[1] = t1;
t1 = F[2];
t2 = F[3];
F[2] = C[3];
F[3] = C[1];
C[1] = A[0];
C[3] = A[1];
A[0] = D[2];
A[1] = D[0];
D[2] = t2;
D[0] = t1;
return;
}
int main()
{
string str;
while (cin >> str) //输入操作序列,下面是执行部分
{
init();
for (int i = 0;i < str.size();i++)
{
switch (str[i])
{
case 'x':
x_rotate();
break;
case 'y':
y_rotate();
break;
case 'z':
z_rotate();
break;
}
}
cout << get_color(A[1]) << get_color(D[2]) << get_color(B[3]) << endl; //输出结果
}
return 0;
}
Maybe