結果

問題 No.662 スロットマシーン
ユーザー 0w10w1
提出日時 2018-04-06 18:32:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 15,404 KB
最終ジャッジ日時 2023-09-08 18:01:50
合計ジャッジ時間 3,225 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,092 KB
testcase_01 AC 79 ms
15,240 KB
testcase_02 AC 79 ms
15,032 KB
testcase_03 AC 78 ms
15,176 KB
testcase_04 AC 80 ms
15,240 KB
testcase_05 AC 78 ms
15,224 KB
testcase_06 AC 82 ms
15,132 KB
testcase_07 AC 81 ms
15,128 KB
testcase_08 AC 86 ms
15,364 KB
testcase_09 AC 90 ms
15,404 KB
testcase_10 AC 93 ms
15,304 KB
testcase_11 AC 89 ms
15,152 KB
testcase_12 AC 90 ms
15,252 KB
testcase_13 AC 88 ms
15,244 KB
testcase_14 AC 90 ms
15,164 KB
testcase_15 AC 89 ms
15,128 KB
testcase_16 AC 78 ms
15,344 KB
testcase_17 AC 89 ms
15,300 KB
testcase_18 AC 90 ms
15,272 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s2c = {}
5.times do
  s, c = gets.split
  s2c[s] = c.to_i
end
c = Array.new(3) { Hash.new { |h, k| h[k] = 0 } }
ns = []
3.times do |i|
  n = gets.to_i
  ns << n
  n.times do 
    s = gets.strip
    c[i][s] += 1
  end
end
p 1.0 * s2c.map { |s, w| c[0][s] * c[1][s] * c[2][s] * 5 * w } .sum / ns.reduce(:*)
puts s2c.map { |s, w| c[0][s] * c[1][s] * c[2][s] * 5 }
0