#includeusing namespace std; string MoFang[6][4]= { {"白", "白",//UP "白", "白"}, {"黄", "黄",//DOWN "黄", "黄"}, {"橙", "橙",//LEFT "橙", "橙"}, {"红", "红",//RIGHT "红", "红"}, {"绿", "绿",//FRONT "绿", "绿"}, {"蓝", "蓝",//BACK "蓝", "蓝"} }; int OperateX[12][2]={{0,3},{0,2},{2,2},{2,3},{1,2},{1,3},{3,3},{3,2}, {4,1},{4,0},{4,2},{4,3}}; int OperateY[12][2]={{0,1},{0,3},{4,1},{4,3},{1,3},{1,1},{5,3},{5,1}, {3,2},{3,3},{3,1},{3,0}}; int OperateZ[12][2]={{4,0},{4,1},{3,2},{3,0},{5,1},{5,0},{2,0},{2,2}, {0,3},{0,1},{0,0},{0,2}}; void XuanZhuan(char Direct) { string temp1,temp2; int index[12][2]; switch(Direct) { case 'x': memcpy(index,OperateX,sizeof(OperateX)); break; case 'y': memcpy(index,OperateY,sizeof(OperateY)); break; case 'z': memcpy(index,OperateZ,sizeof(OperateZ)); break; } temp1=MoFang[index[0][0]][index[0][1]]; temp2=MoFang[index[1][0]][index[1][1]]; for(int i=0;i<6;i++) { MoFang[index[i][0]][index[i][1]]=MoFang[index[i+2][0]][index[i+2][1]]; } MoFang[index[6][0]][index[6][1]]=temp1; MoFang[index[7][0]][index[7][1]]=temp2; temp1=MoFang[index[8][0]][index[8][1]]; for(int i=8;i<11;i++) { MoFang[index[i][0]][index[i][1]]=MoFang[index[i+1][0]][index[i+1][1]]; } MoFang[index[11][0]][index[11][1]]=temp1; } int main() { string opera; char c; cin>>opera; for(int i=0;i 欢迎分享,转载请注明来源:内存溢出
蓝桥杯魔方旋转问题c++ ac
赞
(0)
打赏
微信扫一扫
支付宝扫一扫
leetcode389题找不同
上一篇
2022-12-17
(六)ROS使用C++类
下一篇
2022-12-17
评论列表(0条)