結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
aimy
|
| 提出日時 | 2017-04-28 14:45:37 |
| 言語 | Haskell (9.10.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 474 bytes |
| コンパイル時間 | 264 ms |
| コンパイル使用メモリ | 148,224 KB |
| 最終ジャッジ日時 | 2024-11-15 04:45:06 |
| 合計ジャッジ時間 | 671 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:3:1: error: [GHC-87110]
Could not load module ‘Data.IntMap’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
3 | import Data.IntMap ((!))
| ^^^^^^^^^^^^^^^^^^^^^^^^
Main.hs:4:1: error: [GHC-87110]
Could not load module ‘Data.IntMap’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
4 | import qualified Data.IntMap as M
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
import Data.Bool import Data.List import Data.IntMap ((!)) import qualified Data.IntMap as M primes = 2:3:[x | i<-[1..], j<-[-1,1], let x = 6*i+j, isPrime x] where isPrime n = null [i | i <- takeWhile (\x -> x^2 <= n) primes, rem n i == 0] main = readLn >>= putStrLn . bool "Lose" "Win" . pgame pgame n = (foldl' grundy (M.fromList [(2,0),(3,0)]) [4..n]) ! n /= 0 where grundy im i = M.insert i (minimum ([0..11] \\ (map (im!) (takeWhile (>=2) (map (i-) primes))))) im
aimy