No.785 Color-Eating Bugs
Problem Statement
Color-eating bugs live in yuki's PC.
If a hexadecimal color code contains certain characters,
the color-eating bugs eat that color.
For each of R, G, and B, there are characters that the color-eating bugs eat.
A color is no longer displayed if it is eaten at even one position.
What is the maximum number of colors that yuki's PC can display?
(An explanation of hexadecimal color codes follows.)
#00FF66 ← an example of a hexadecimal color code
A hexadecimal color code consists of 24 bits. Starting from the most significant bit,
the values of R, G, and B are stored in 8-bit segments. RGB refers to the three primary colors of light,
which stand for Red, Green, and Blue respectively.
The notation begins with "#", followed by the value of the 24 bits
written in hexadecimal.
Input
R1,R2,R3,・・・・・・,Rr G1,G2,G3,・・・・・・,Gg B1,B2,B3,・・・・・・,Bb* If there are no characters to be eaten, "NONE" is given.
The following three lines
(the characters for R that the color-eating bugs eat) --- r characters
(the characters for G that the color-eating bugs eat) --- g characters
(the characters for B that the color-eating bugs eat) --- b characters
are given as input.
Each of R, G, and B is given as a character from "0 to 9" or "A to F".
If multiple characters are eaten, they are given separated by "," (half-width comma).
If there are no characters to be eaten, "NONE" is given.
The same character is never given more than once within a single line.
Output
Output the number of colors that can be displayed.
Sample
Sample 1
Input
0,1,2,3,4,5,6,7,8,9,A,B 0,1,2,3,4,5,6,7,8,9,A,B 0,1,2,3,4,5,6,7,8,9,A,B
Output
4096
Colors whose hexadecimal color code contains the following characters are not displayed:
R "0,1,2,3,4,5,6,7,8,9,A,B"
G "0,1,2,3,4,5,6,7,8,9,A,B"
B "0,1,2,3,4,5,6,7,8,9,A,B"
Sample 2
Input
5,7,9,B,D,F 2,4,6,8 A
Output
3240000
Colors whose hexadecimal color code contains the following characters are not displayed:
R "5,7,9,B,D,F"
G "2,4,6,8"
B "A"
Sample 3
Input
NONE NONE NONE
Output
16777216
This is the same as the maximum number of displayable colors in 24-bit color.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
No