|
||||||||||
Rubik's CubeTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 159 Accepted Submission(s): 43 Problem Description As we all know, Zhu is the wisest man. When Liao was ninety-nine years old, the Zhu appeared to him and said, "I am God Almighty; walk before me and be blameless. I will confirm my covenant between me and you and will greatly increase your wisdom." At that time, Liao has a problem: Liao has a Rubik's Cube and the surfaces of it are drawn as black or white. He can rotate it as the rules of the Rubik's Cube. Liao asked Zhu:"how many states the Rubik's Cube can reach?" Zhu is omniscient and omnipotent, but he did not tell the answer. Can you tell the poor man the answer? Remember two states are regarded as the same one if you change views and find the two states is the same one. For those of you unfamiliar with the puzzle, a Rubik's Cube, comes in the form of a cube where each face is divided into three rows and three columns (nine "squares". Any of the six faces of the cube may be rotated either clockwise or counterclockwise, which also rotates the three nearest squares on each adjoining face onto a new face, respectively. Input Intput contains multiple test cases. The first line is an integer $1 \leq T \leq 10$, the number of test cases. Each case begins with an integer $n$, indicating the number of the squares of blacks. The next line contains $n$ integers $a_1 , a_2 ,.., a_n$, representing squares indexed as $a_1,a_2,..,a_n$ are black respectively. All $a_i$ are defferent. The indexes of squares are showed in the pictures. $(0 \leq n \leq 5, 0 \leq a_i \leq 53)$. Output For each test case,output a single line "Case #x: y", where x is the case number, starting from 1. And y is the answer. Sample Input
Sample Output
Author UESTC Source | ||||||||||
|