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

Painting the Football

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 276    Accepted Submission(s): 100


Problem Description
The football, well known as a worldwide popular sport, is made of 12 regular pentagons and 20 regular hexagons.

In this problem, L has to color a new football. The football is totally white in the beginning and L has to color some of its faces into black (maybe zero). Look at the picture below, the 32 faces of a football are numbered from 1 to 32. Two faces are considered connected if and only if they share a same side such like 12 and 13 as well as 29 and 30. Each step L can choose some connected faces of the football and color all these faces into black or white no matter what color it used to be. For example, L can color the faces 2, 3, 4 and 5 at the same time, but he can¡¯t color the faces 26 and 29 at the same time.

Now give the target state of the football, your task is calculating the minimum steps that L needs to do.
 

Input
The first line of the date is an integer T, which is the number of the text cases.
Then T cases follow describe a target state. Each case contains 32 integers in a line. If the ith number in this line is 1, it means that the face with index i need to color to black, otherwise it need to color to white.
 

Output
For each test case, output the case number first, then output minimum steps L needs to do to color the football to the target state.
 

Sample Input
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1
 

Sample Output
Case 1: 1 Case 2: 2
 

Hint

Some useful information:
In the original football, the face 1 and face 13 is connected, the face 13 and face 17 are connected, the face 17 and face 32 are connected, the face 15 and face 32 are connected and the face 19 and face 32 are connected.

If you are still lack of imagination, maybe the follow links may help you:
http://www1.esgweb.net/Article/UploadFiles09/200810/2008101900394743.gif
http://www1.esgweb.net/Article/UploadFiles09/200810/2008101900394998.gif
http://www.3dcadbrowser.com/download.aspx?3dmodel=21288
 

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-26 03:17:50, Gzip enabled