#P10984. Seven Segment Display Possibilities
Seven Segment Display Possibilities
Seven Segment Display Possibilities
A seven-segment display is a common electronic component used to display digits. It consists of 7 segments labeled \(A, B, C, D, E, F, G\). A digit from \(0\) to \(9\) is normally represented by lighting certain segments. The conventional representations are:
Digit | State Code | Digit | State Code |
---|---|---|---|
0 | \(1111110\) | 5 | \(1011011\) |
1 | \(0110000\) | 6 | \(1011111\) |
2 | \(1101101\) | 7 | \(1110000\) |
3 | \(1111001\) | 8 | \(1111111\) |
4 | \(0110011\) | 9 | \(1111011\) |
In this problem, a number of length 18 is shown on 18 seven-segment displays (each digit may include leading zeros). Due to some malfunction, some segments that should be lit remain off. In other words, if a segment is observed to be lit (represented by '1'), it must be lit in the original digit; however, segments observed off ('0') might have been on originally. For each seven-segment digit, an observed state (a 7-digit binary string) is given. A digit \(d\) (with its standard state code) is possible for that display if for every segment, the observed state has a '1' only when the digit's normal state also has a '1'.
Your task is to compute the total number of possible original 18-digit numbers that could have produced the observed states. The answer is the product of possibilities for each display.
Note: All formulas are in \(\LaTeX\) format.
inputFormat
The input contains 18 seven-segment state codes separated by spaces. Each state code is a 7-digit binary string representing the state (A to G) of a display (from high digit to low digit).
outputFormat
Output a single number, which is the total count of possible original 18-digit numbers based on the observed states.
sample
0000011 1001011 0000001 0100001 0101011 0110110 1111111 0010110 0101001 0010110 1011100 0100110 1010000 0010011 0001111 0101101 0110101 1101010
254016000