結果
問題 | No.212 素数サイコロと合成数サイコロ (2) |
ユーザー | Michae'Gon |
提出日時 | 2015-07-19 03:31:29 |
言語 | Haskell (9.8.2) |
結果 |
MLE
|
実行時間 | - |
コード長 | 439 bytes |
コンパイル時間 | 11,181 ms |
コンパイル使用メモリ | 165,984 KB |
実行使用メモリ | 806,904 KB |
最終ジャッジ日時 | 2023-09-22 19:09:35 |
合計ジャッジ時間 | 14,147 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,604 KB |
testcase_01 | AC | 13 ms
11,904 KB |
testcase_02 | AC | 3 ms
7,608 KB |
testcase_03 | AC | 12 ms
11,880 KB |
testcase_04 | AC | 3,334 ms
219,540 KB |
testcase_05 | MLE | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
コンパイルメッセージ
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 Control.Monad import Data.List main = getLine >>= print . solve . map read . words solve :: [Int] -> Double solve [p, c] = fromIntegral a / fromIntegral b where ff (acc, m) x = (head x * len + acc, m + len) where len = length x (a, b) = foldl ff (0, 0) muls muls = group . sort . foldl (liftM2 (*)) [1] $ replicate p [2, 3, 5, 7, 11, 13] ++ replicate c [4, 6, 8, 9, 10, 12]