結果
問題 | No.662 スロットマシーン |
ユーザー | pekempey |
提出日時 | 2018-03-10 16:05:15 |
言語 | Haskell (9.6.2) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 798 bytes |
コンパイル時間 | 5,611 ms |
コンパイル使用メモリ | 159,732 KB |
実行使用メモリ | 13,508 KB |
最終ジャッジ日時 | 2023-08-03 16:22:19 |
合計ジャッジ時間 | 7,896 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,292 KB |
testcase_01 | AC | 2 ms
7,332 KB |
testcase_02 | AC | 3 ms
7,504 KB |
testcase_03 | AC | 3 ms
7,908 KB |
testcase_04 | AC | 5 ms
8,624 KB |
testcase_05 | AC | 3 ms
7,548 KB |
testcase_06 | AC | 5 ms
9,180 KB |
testcase_07 | AC | 5 ms
9,164 KB |
testcase_08 | AC | 12 ms
12,588 KB |
testcase_09 | AC | 12 ms
13,464 KB |
testcase_10 | AC | 12 ms
13,492 KB |
testcase_11 | AC | 12 ms
13,460 KB |
testcase_12 | AC | 22 ms
13,360 KB |
testcase_13 | AC | 23 ms
13,360 KB |
testcase_14 | AC | 23 ms
13,508 KB |
testcase_15 | AC | 22 ms
13,404 KB |
testcase_16 | AC | 3 ms
7,520 KB |
testcase_17 | AC | 23 ms
13,460 KB |
testcase_18 | AC | 23 ms
13,464 KB |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Data.List import Data.Maybe import Control.Monad main = do dic <- replicateM 5 readKV (n1, a) <- readReel (map fst dic) (n2, b) <- readReel (map fst dic) (n3, c) <- readReel (map fst dic) -- [0] [1] [2] [3] [4] -- 000 0 0 -- 000 0 0 -- 000 0 0 let cnt = map (\k -> let x = a!!k; y = b!!k; z = c!!k in 5*x*y*z) $ [0..4] let ans = sum $ zipWith (*) cnt (map snd dic) print $ fromIntegral ans / fromIntegral (n1 * n2 * n3) mapM_ print cnt readKV :: IO (String, Int) readKV = do [k, v] <- words <$> getLine return (k, read v) readReel :: [String] -> IO (Int, [Int]) readReel dic = do n <- readLn :: IO Int x <- replicateM n (fromJust . flip elemIndex dic <$> getLine) return (n, [length . filter (==i) $ x | i <- [0..4]])