Ultraviolet A 10601 cubes

Source: Internet
Author: User

Uva_10601

ForCubeBody, a total of 24 essentially different rotations, divided into four categories as a whole:

① Static;

② Take the line between a plane and the center of the opposite side as the axis, and rotate 90 degrees, 180 degrees, and 270 degrees in one direction;

③ Take the link between an edges and the edges as the axis and rotate 180 degrees in one direction;

④ Take the line between a vertex and the vertex as the axis and rotate 60 degrees and 120 degrees along one direction.

For each type of data, you can use a combination of numbers to calculate the number of different types of data. Then, you can apply the Burnside theorem to get the final result.

# Include <stdio. h> # Include <String . H> Int A [ 6 ], B [ 6 ], C [ 15 ] [ 15  ];  Void  Prepare (){  Int  I, J; memset (C,  0 , Sizeof  (C); C [  0 ] [0 ] = 1  ;  For (I = 1 ; I <= 12 ; I ++ ) {C [I] [  0 ] = C [I] [I] = 1  ;  For (J = 1 ; J <I; j ++ ) C [I] [J] = C [I- 1 ] [J] + C [I-1 ] [J- 1  ] ;}}  Void  Init (){  Int  I, K; memset (,  0 , Sizeof  ());  For (I = 0 ; I < 12 ; I ++ ) {Scanf (  " % D  " ,& K ); ++ A [k- 1  ] ;}}  Long   Long Calculate ( Int  M ){  Int I, j, n = 0  ;  Long   Long Ans = 1 ;  For (I = 0 ; I < 6 ; I ++ ){  If (B [I] % m! = 0  )  Return   0  ; B [I] /= M; n + = B [I];}  For (I =0 ; I < 6 ; I ++ ) {Ans * = C [N] [B [I]; n -= B [I];}  Return  Ans ;}  Long   Long  Fsolve (){  Long   Long Ans = 0  ; Memcpy (B,,  Sizeof (A); ans + = Calculate ( 1  ); Memcpy (B,,  Sizeof  (A); ans + = 6 * Calculate ( 4  ); Memcpy (B,,  Sizeof  (A); ans + = 3 * Calculate ( 2  );  Return  Ans ;} Long   Long  Esolve (){  Int  I, J;  Long   Long Ans = 0  ;  For (I = 0 ; I < 6 ; I ++ )  For (J = 0 ; J <6 ; J ++ ) {Memcpy (B,,  Sizeof  ()); -- B [I], -- B [J];  If (B [I] < 0 | B [J] < 0  )  Continue  ; Ans + = 6 * Calculate ( 2 );}  Return  Ans ;}  Long   Long  Vsolve (){  Long   Long Ans = 0  ; Memcpy (B,,  Sizeof  (A); ans = 8 * Calculate ( 3  );  Return Ans ;}  Void  Solve (){  Long   Long Ans = 0  ; Ans + = Fsolve (); ans + = Esolve (); ans + = Vsolve (); printf (  "  % LLD \ n  " , ANS/ 24  );} Int  Main (){  Int  T; prepare (); scanf (  "  % D  " ,& T );  While (T -- ) {Init (); solve ();}  Return   0  ;} 

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.