結果

問題 No.662 スロットマシーン
ユーザー 👑 obakyanobakyan
提出日時 2019-04-30 11:41:53
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 5,372 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-28 13:48:32
合計ジャッジ時間 1,280 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 4 ms
4,504 KB
testcase_18 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local ior = io.input()
local dic = {}
local score = {}
local cnt = {}
local len = {}
local str = ""
for i = 1, 3 do cnt[i] = {} end
for i = 1, 5 do
  str = ior:read()
  local name = str:match("%w+")
  local num = tonumber(str:match("%d+"))
  dic[name] = i
  score[i] = num
  for j = 1, 3 do cnt[j][i] = 0 end
end
for i = 1, 3 do
  len[i] = ior:read("*n", "*l")
  for j = 1, len[i] do
    str = ior:read()
    cnt[i][dic[str]] = cnt[i][dic[str]] + 1
  end
end
local c = {}
local e = 0
for i = 1, 5 do
  c[i] = 5 * cnt[1][i] * cnt[2][i] * cnt[3][i]
  e = e + c[i] * score[i] / len[1] / len[2] / len[3]
end
print(string.format("%.8f", e))
for i = 1, 5 do print(c[i]) end
0