結果

問題 No.662 スロットマシーン
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2020-01-16 21:18:38
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 11,488 KB
実行使用メモリ 15,396 KB
最終ジャッジ日時 2023-09-06 13:55:35
合計ジャッジ時間 2,790 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
15,080 KB
testcase_01 AC 68 ms
15,148 KB
testcase_02 AC 70 ms
15,128 KB
testcase_03 AC 69 ms
15,064 KB
testcase_04 AC 70 ms
15,288 KB
testcase_05 AC 70 ms
15,256 KB
testcase_06 AC 71 ms
15,020 KB
testcase_07 AC 72 ms
15,252 KB
testcase_08 AC 78 ms
15,396 KB
testcase_09 AC 78 ms
15,220 KB
testcase_10 AC 84 ms
15,208 KB
testcase_11 AC 79 ms
15,284 KB
testcase_12 AC 78 ms
15,212 KB
testcase_13 AC 80 ms
15,244 KB
testcase_14 AC 79 ms
15,212 KB
testcase_15 AC 80 ms
15,380 KB
testcase_16 AC 68 ms
15,252 KB
testcase_17 AC 78 ms
15,168 KB
testcase_18 AC 77 ms
15,260 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:21: warning: assigned but unused variable - pay
Syntax OK

ソースコード

diff #

A = Array.new(3){Array.new(5, 0)} 
Z = Array.new(3)
H = {}
F = 5.times.map do |i|
  face, pay = gets.split
  H[face] = i
  [face, pay.to_i]
end

R = 3.times.map do |i|
  n = gets.to_i
  Z[i] = n
  n.times do 
    j = H[gets.chomp]
    A[i][j] += 1
  end
end
T = Z.inject(&:*)

ANS2 = 5.times.map do |i|
  pay = F[i][1]
  A[0][i] * A[1][i] * A[2][i] * 5
end
ANS1 = ANS2.each_with_index.inject(0.0){|s,(v,i)| s + F[i][1] * v } / T
puts ANS1
puts ANS2
0