結果

問題 No.785 色食い虫
コンテスト
ユーザー Takuya Noguchi
提出日時 2020-06-28 21:28:36
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 400 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 124 ms
コンパイル使用メモリ 9,216 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2026-03-30 00:23:18
合計ジャッジ時間 2,797 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

color_code = [*'0'..'9', *'A'..'F'].repeated_permutation(2).to_a

r = gets.chomp.split(',')
g = gets.chomp.split(',')
b = gets.chomp.split(',')

count = 1

[r, g, b].each do |reject_color_codes|
  count *= if reject_color_codes.first == 'NONE'
             color_code.count
           else
             color_code.select { |c| (c & reject_color_codes).size == 0 }.count
           end
end

puts count
0