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

BrokenLED

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


Problem Description
You know, there are more and more LED Displays used for show numbers in everywhere, a general product is like the left picture below, called as 7 segments LED, because it can show all the digitals from 0 to 9 with 7 segments as the right picture below.

There are many 7 segment LED displays in our restraint, so we can view the money left in our sunny card. Unfortunately, some displays always with one or more segment are broken, that means, the segment which should be light up when it display a digital can't work. For example, if the 'a' segment is broken, then '7' and '1' will be displayed as '1' either.
Now, Bob who is standing on front of a broken LED display want to know, how many possible results would be the number on the display. For example, with a LED display which it's all 'a' segments were broken, "11" would be 4 possible results which are "11", "17", "71" and "77". Note that pre-zeros are valid, for example, "0001" is equal to "1" or "01".
 

Input
There are multiply test cases, every case start with a single integers N in the first line, that is how many LED in this case, the second line is a string shows which segment is broken in the LED from 'a' to 'g', good segment will replace as '-', the follow N lines will hold a string in each line to show numbers from left to right, which shows the lighted segment in the i-th LED. (1 <= N <= 9)
Input will end with a single line which N == -1.
 

Output
For each test case, output an integer that how many possible numbers should be the LEDs described by the input in a single line.
 

Sample Input
2 a------ --c--f- --c--f- -1
 

Sample Output
Case 1: 4
 

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 14:37:15, Gzip enabled