temp

  1 #include<iostream>
  2 #include<cstdio>
  3 #include<cstring>
  4 #include<algorithm>
  5 using namespace std;
  6 int T,cube[7][5][5];
  7 char s[500];
  8 inline void ini(){
  9     memset(cube,0,sizeof(cube));
 10     int cnt=0;
 11     for(register int face=1;face<=6;face++){
 12         for(register int i=1;i<=3;i++){
 13             for(register int j=1;j<=3;j++){
 14                 cube[face][i][j]=++cnt;
 15             }
 16         }
 17     }
 18 }
 19 inline void w(int c[7][5][5],int ID){
 20     int temp[4][4];
 21     for(register int i=1;i<=3;i++){
 22         for(register int j=1;j<=3;j++){
 23             temp[i][j]=c[ID][i][j];
 24         }
 25     }
 26     for(register int i=1;i<=3;i++){
 27         for(register int j=1;j<=3;j++){
 28             c[ID][i][j]=temp[4-j][i];
 29         }
 30     }
 31 }
 32 inline void a(int c[7][5][5],int ID){
 33     int temp[4][4];
 34     for(register int i=1;i<=3;i++){
 35         for(register int j=1;j<=3;j++){
 36             temp[i][j]=c[ID][i][j];
 37         }
 38     }
 39     for(register int i=1;i<=3;i++){
 40         for(register int j=1;j<=3;j++){
 41             c[ID][j][4-i]=temp[i][j];
 42         }
 43     }
 44 }
 45 inline void up_wise(){
 46     w(cube,2);
 47     int temp[7][5][5];
 48     memcpy(temp,cube,sizeof(cube));
 49     w(temp,1),w(temp,3),w(temp,5),w(temp,6);
 50     for(register int i=1;i<=3;i++){
 51         cube[][][]=temp[][][];
 52         cube[][][]=temp[][][];
 53         cube[][][]=temp[][][];
 54         cube[][][]=temp[][][];
 55     }
 56 }
 57 inline void up_anti(){
 58     a(cube,2);
 59     int temp[7][5][5];
 60     memcpy(cube,temp,sizeof(cube));
 61     a(temp,1),a(temp,3),a(temp,5),a(temp,6);
 62     for(register int i=1;i<=3;i++){
 63         cube[][][]=temp[][][];
 64         cube[][][]=temp[][][];
 65         cube[][][]=temp[][][];
 66         cube[][][]=temp[][][];
 67     }
 68 }
 69 inline void down_wise(){
 70     w(cube,4);
 71     int temp[7][5][5];
 72     memcpy(cube,temp,sizeof(cube));
 73     w(temp,3),w(temp,1),w(temp,5),w(temp,6);
 74     for(register int i=1;i<=3;i++){
 75         cube[][][]=temp[][][];
 76         cube[][][]=temp[][][];
 77         cube[][][]=temp[][][];
 78         cube[][][]=temp[][][];
 79     }
 80 }
 81 inline void down_anti(){
 82     a(cube,4);
 83     int temp[7][5][5];
 84     memcpy(cube,temp,sizeof(cube));
 85     a(temp,3),a(temp,1),a(temp,5),a(temp,6);
 86     for(register int i=1;i<=3;i++){
 87         cube[][][]=temp[][][];
 88         cube[][][]=temp[][][];
 89         cube[][][]=temp[][][];
 90         cube[][][]=temp[][][];
 91     }
 92 }
 93 inline void front_wise(){
 94     w(cube,1);
 95     int temp[7][5][5];
 96     memcpy(cube,temp,sizeof(cube));
 97     w(temp,2),w(temp,3),w(temp,4),w(temp,5);
 98     for(register int i=1;i<=3;i++){
 99         cube[][][]=temp[][][];
100         cube[][][]=temp[][][];
101         cube[][][]=temp[][][];
102         cube[][][]=temp[][][];
103     }
104 }
105 inline void front_anti(){
106     a(cube,1);
107     int temp[7][5][5];
108     memcpy(cube,temp,sizeof(cube));
109     a(temp,2),a(temp,3),a(temp,4),a(temp,5);
110     for(register int i=1;i<=3;i++){
111         cube[][][]=temp[][][];
112         cube[][][]=temp[][][];
113         cube[][][]=temp[][][];
114         cube[][][]=temp[][][];
115     }
116 }
117 inline void back_wise(){
118     w(cube,6);
119     int temp[7][5][5];
120     memcpy(cube,temp,sizeof(cube));
121     w(temp,3),w(temp,2),w(temp,4),w(temp,5);
122     for(register int i=1;i<=3;i++){
123         cube[][][]=temp[][][];
124         cube[][][]=temp[][][];
125         cube[][][]=temp[][][];
126         cube[][][]=temp[][][];
127     }
128 }
129 inline void back_anti(){
130     a(cube,6);
131     int temp[7][5][5];
132     memcpy(cube,temp,sizeof(cube));
133     a(temp,3),a(temp,2),a(temp,4),a(temp,5);
134     for(register int i=1;i<=3;i++){
135         cube[][][]=temp[][][];
136         cube[][][]=temp[][][];
137         cube[][][]=temp[][][];
138         cube[][][]=temp[][][];
139     }
140 }
141 inline void left_wise(){
142     w(cube,3);
143     int temp[7][5][5];
144     memcpy(cube,temp,sizeof(cube));
145     w(temp,2),w(temp,1),w(temp,4),w(temp,6);
146     for(register int i=1;i<=3;i++){
147         cube[][][]=temp[][][];
148         cube[][][]=temp[][][];
149         cube[][][]=temp[][][];
150         cube[][][]=temp[][][];
151     }
152 }
153 inline void left_anti(){
154     a(cube,3);
155     int temp[7][5][5];
156     memcpy(cube,temp,sizeof(cube));
157     a(temp,2),a(temp,1),a(temp,4),a(temp,6);
158     for(register int i=1;i<=3;i++){
159         cube[][][]=temp[][][];
160         cube[][][]=temp[][][];
161         cube[][][]=temp[][][];
162         cube[][][]=temp[][][];
163     }
164 }
165 inline void right_wise(){
166     w(cube,5);
167     int temp[7][5][5];
168     memcpy(cube,temp,sizeof(cube));
169     w(temp,1),w(temp,2),w(temp,4),w(temp,6);
170     for(register int i=1;i<=3;i++){
171         cube[][][]=temp[][][];
172         cube[][][]=temp[][][];
173         cube[][][]=temp[][][];
174         cube[][][]=temp[][][];
175     }
176 }
177 inline void right_anti(){
178     a(cube,5);
179     int temp[7][5][5];
180     memcpy(cube,temp,sizeof(cube));
181     a(temp,1),a(temp,2),a(temp,4),a(temp,6);
182     for(register int i=1;i<=3;i++){
183         cube[][][]=temp[][][];
184         cube[][][]=temp[][][];
185         cube[][][]=temp[][][];
186         cube[][][]=temp[][][];
187     }
188 }
189 int main(){
190     ini();
191     for(register int i=1;i<=3;i++){
192         for(register int j=1;j<=3;j++){
193             cout<<cube[5][i][j]<<' ';
194         }
195         cout<<endl;
196     }
197     up_wise();
198     for(register int i=1;i<=3;i++){
199         for(register int j=1;j<=3;j++){
200             cout<<cube[5][i][j]<<' ';
201         }
202         cout<<endl;
203     }
204     // cin>>T;
205     // for(register int t=1;t<=T;t++){
206     //     scanf("%s",s);
207     //     int size=strlen(s);
208 
209     // }
210 }

猜你喜欢

转载自www.cnblogs.com/Fang-Hao/p/9107894.html
今日推荐