問題一覧 > 通常問題

No.785 Color-Eating Bugs

レベル : / AI推定難易度 : 133 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 284
作問者 : No / テスター : ミドリムシ
お気に入りにしたユーザー ProblemId : 1879 / 自分の提出
問題文最終更新日: 2019-02-08 21:23:28
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 205 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。