Blue Bridge Cup 2017 fourth question Rubik's Cube state

Source: Internet
Author: User
Tags ming
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;                                                                                                                                                                                                                                                   }
 }


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.