思路:
模拟;
代码:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; struct MFType {
int ai[][];
};
struct MFType ci[]; int len; char done[],ch[]; /* 1.front
2.back
3.left
4.right
5.top
6.under */ void OperationType_right_turning90()
{
MFType *now=&ci[],tmp=ci[];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now=&ci[],tmp=ci[];
MFType *pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&tmp;
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
} void OperationType_right_turningback90()
{
MFType *now=&ci[],tmp=ci[];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now=&ci[],tmp=ci[];
MFType *pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&tmp;
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
} void OperationType_top_turning90()
{
MFType *now=&ci[],tmp=ci[];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now=&ci[],tmp=ci[];
MFType *pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&tmp;
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
} void OperationType_top_turningback90()
{
MFType *now=&ci[],tmp=ci[];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now=&ci[],tmp=ci[];
MFType *pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&tmp;
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
} void debug()
{
printf("\n");
for(int i=;i<=;i++)
{
printf("%d\n",i);
for(int j=;j<=;j++)
{
for(int v=;v<=;v++) printf("%d",ci[i].ai[j][v]);
printf("\n");
}
printf("\n");
}
printf("\n");
} int main()
{
freopen("cube.in","r",stdin);
freopen("cube.out","w",stdout);
scanf("%s",done),len=strlen(done);
for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
scanf("%s",ch);
for(int v=;v<=;v++) ci[i].ai[j][v]=ch[v-]-'';
}
}
// debug();
for(int i=;i<len;i++)
{
if(done[i]=='') OperationType_right_turning90();
else if(done[i]=='') OperationType_right_turningback90();
else if(done[i]=='') OperationType_top_turning90();
else if(done[i]=='') OperationType_top_turningback90();
// debug();
}
for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
for(int v=;v<=;v++) printf("%d",ci[i].ai[j][v]);
printf("\n");
}
}
return ;
}