結果

問題 No.785 色食い虫
ユーザー Takuya Noguchi
提出日時 2020-06-28 21:28:36
言語 Ruby
(3.4.1)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 37 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-08 07:24:39
合計ジャッジ時間 3,505 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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