結果
問題 | No.337 P versus NP |
ユーザー | kuwa |
提出日時 | 2016-01-29 22:22:51 |
言語 | Haskell (9.6.2) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 775 bytes |
コンパイル時間 | 3,953 ms |
コンパイル使用メモリ | 143,404 KB |
最終ジャッジ日時 | 2023-10-21 16:41:17 |
合計ジャッジ時間 | 4,369 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) Main.hs:7:1: error: Could not load module ‘Data.ByteString.Char8’ It is a member of the hidden package ‘bytestring-0.11.4.0’. You can run ‘:set -package bytestring’ to expose it. (Note: this unloads all the modules in the current scope.) Use -v (or `:set -v` in ghci) to see a list of the files searched for. | 7 | import qualified Data.ByteString.Char8 as BC | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Main.hs:8:1: error: Could not load module ‘Data.ByteString’ It is a member of the hidden package ‘bytestring-0.11.4.0’. You can run ‘:set -package bytestring’ to expose it. (Note: this unloads all the modules in the current scope.) Use -v (or `:set -v` in ghci) to see a list of the files searched for. | 8 | import qualified Data.ByteString as BC | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
module Main where import Control.Monad import Control.Applicative import Data.Maybe import Data.List import qualified Text.Printf import qualified Data.ByteString.Char8 as BC import qualified Data.ByteString as BC ------------------------------------------ main :: IO () main = do [n, p] <- readInts putStrLn $ if p == n * p then "=" else "!=" ------------------------------------------ {- Int input -} parseInt :: BC.ByteString -> Int parseInt = fst . fromJust . BC.readInt parseInts :: BC.ByteString -> [Int] parseInts = map parseInt <$> BC.words readInt :: IO Int readInt = parseInt <$> BC.getLine readInts :: IO [Int] readInts = parseInts <$> BC.getLine {- Double Formatting -} doubleFormat :: Double -> String doubleFormat = Text.Printf.printf "%.12f"