P10984 [Lanqiao Cup 2023 National Python A/Java A] Incomplete Digits

Description

A seven-segment display is a common electronic component used to display digits. It consists of seven light segments: ![](https://cdn.luogu.com.cn/upload/image_hosting/pwjpl23s.png) The figure above shows, in order, how the digits $0\sim 9$ are displayed using a seven-segment display. A yellow segment means it is lit, and a gray segment means it is off. Based on the on/off states of the segments, we can use a state code (a $7$-bit binary number) to represent a seven-segment display. Let the state be $1$ when a segment is lit, and $0$ when a segment is off. If we label the seven segments in the order $\rm ABCDEFG$, then the state codes for digits $0 \sim 9$ 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$| Xiao Lan has a favorite number of length $18$. Each digit is shown using one seven-segment display (each digit can only be $0 \sim 9$, and leading zeros are allowed). Due to a segment failure, some segments that should be lit are instead off. For example, for a number of length $2$, when the state codes of the two seven-segment displays are $1011111$ (higher digit) and $1110011$ (lower digit), the original number could have been $68$, $69$, $88$, or $89$, for a total of $4$ possible values. The state codes for the $18$ seven-segment displays are: $0000011$, $1001011$, $0000001$, $0100001$, $0101011$, $0110110$, $1111111$, $0010110$, $0101001$, $0010110$, $1011100$, $0100110$, $1010000$, $0010011$, $0001111$, $0101101$, $0110101$, $1101010$. Each of the above is the state code for one seven-segment display (given from the highest digit to the lowest digit). Please determine how many possible values Xiao Lan’s favorite number could be.

Input Format

N/A

Output Format

Output one integer in one line, representing the answer.

Explanation/Hint

Translated by ChatGPT 5