F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Rubik's Cube

Time 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
3 2 0 47 2 24 53 2 36 46
 

Sample Output
Case #1: 15 Case #2: 15 Case #3: 24
 

Author
UESTC
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 04:28:02, Gzip enabled