The whole arrangement question title: Rubik's Cube State second-order Rubik's Cube is only 2 layers of Rubik's Cube, only by 8 small pieces composition. As shown in Figure P1.png. Xiao Ming is very naughty, he only like 3 kinds of colors, all the second-order Rubik's house to re-color, as follows: Front: Orange to the right: Green above: Yellow left: Green below: Orange back: yellow Please calculate, how many different states. If the two states are rotated by the whole of the Rubik's Cube, the colors of each face are identical, and the same state is considered. Please submit an integer representing the number of States, and do not fill in any extraneous or descriptive text.
Package Blue Bridge 17;
Import java.util.ArrayList;
Import Java.util.Arrays;
Import java.util.List; public Class D Rubik's Cube state {/** * * Title: Rubik's Cube Status * * Second-order Rubik's Cube is only 2 layers of Rubik's Cube, consisting of only 8 small pieces.
As shown in Figure P1.png. * Xiao Ming is very naughty, he only like 3 colors, all the second-order Rubik's house to re-color, as follows: * * Front: Orange to the right: Green above: Yellow left: Green below: orange back: Yellow * * Please calculate how many different
The state.
* * If the two states after the whole cube rotation, the color of each face is consistent, it is considered to be the same state.
* * Please submit an integer representing the number of States, do not fill in any superfluous content or descriptive text.
* * @param args */////////through analysis, this Rubik's Cube altogether eight pieces are yellow orange green four orange orange green two pieces of yellow and yellow green two//that the problem becomes 11112233 of the full alignment problems//But 11112233 and 33221111 the same
static int count;
Static list<string> list=new arraylist<> ();
public static void Main (string[] args) {String string= "11112233";
F (String.tochararray (), 0);
System.out.println (count);
} private static void F (char[] chararray, int i) {if (i==8) {string String=new string (Chararray);
String String2=reverse (String); if (List.contains (string) | |
List.contains (string2)) {return;
} count++;
System.out.println (string); List.add (STring);
} for (int j = i; J < Chararray.length; J + +) {char old=chararray[i];
CHARARRAY[I]=CHARARRAY[J];
Chararray[j]=old;
F (Chararray, i+1);
Old=chararray[i];
CHARARRAY[I]=CHARARRAY[J];
Chararray[j]=old;
}} private static String reverse (String string) {string string2= "";
for (int i = 0; i < string.length (); i++) {String2=string.charat (i) +string2;
} return string2; }
}