#P10984. [蓝桥杯 2023 国 Python A/Java A] 残缺的数字

[蓝桥杯 2023 国 Python A/Java A] 残缺的数字

Problem Description

A seven-segment display is a common electronic component used to display digits. It consists of seven light segments:

The figure above shows, in order, how the digits 090\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 77-bit binary number) to represent a seven-segment display. Let the state be 11 when a segment is lit, and 00 when a segment is off. If we label the seven segments in the order ABCDEFG\rm ABCDEFG, then the state codes for digits 090 \sim 9 are:

Digit State Code Digit State Code
00 11111101111110 55 10110111011011
11 01100000110000 66 10111111011111
22 11011011101101 77 11100001110000
33 11110011111001 88 11111111111111
44 01100110110011 99 11110111111011

Xiao Lan has a favorite number of length 1818. Each digit is shown using one seven-segment display (each digit can only be 090 \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 22, when the state codes of the two seven-segment displays are 10111111011111 (higher digit) and 11100111110011 (lower digit), the original number could have been 6868, 6969, 8888, or 8989, for a total of 44 possible values.

The state codes for the 1818 seven-segment displays are:

00000110000011, 10010111001011, 00000010000001, 01000010100001, 01010110101011, 01101100110110, 11111111111111, 00101100010110, 01010010101001, 00101100010110, 10111001011100, 01001100100110, 10100001010000, 00100110010011, 00011110001111, 01011010101101, 01101010110101, 11010101101010.

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.

Output Format

Output one integer in one line, representing the answer.

Hint

Translated by ChatGPT 5