結果
問題 | No.193 筒の数式 |
ユーザー | ducktail |
提出日時 | 2018-08-03 20:47:04 |
言語 | Haskell (9.10.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 707 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 149,376 KB |
最終ジャッジ日時 | 2024-11-14 20:33:46 |
合計ジャッジ時間 | 636 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:5:1: error: [GHC-87110] Could not load module ‘Text.Parsec’. It is a member of the hidden package ‘parsec-3.1.17.0’. Use -v to see a list of the files searched for. | 5 | import Text.Parsec (parse, many, many1, eof) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Main.hs:6:1: error: [GHC-87110] Could not load module ‘Text.Parsec.String’. It is a member of the hidden package ‘parsec-3.1.17.0’. Use -v to see a list of the files searched for. | 6 | import Text.Parsec.String (Parser) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Main.hs:7:1: error: [GHC-87110] Could not load module ‘Text.Parsec.Char’. It is a member of the hidden package ‘parsec-3.1.17.0’. Use -v to see a list of the files searched for. | 7 | import Text.Parsec.Char (digit, char) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
importControl.Applicative(<$>),(<|>)importData.Listfoldl',tails,initsimportData.EitherrightsimportText.Parsecparse,many,many,eofimportText.Parsec.StringParserimportText.Parsec.Chardigit,charmain::IO()main = solve <$> getLine >>= printsolve::String->Intsolve s = maximum . rights . map (parse expr "") $ zipWith (++) (tails s) (inits s)expr::ParserIntexpr = dox <- numfs <- many (plus <|> minus)eofreturn $ foldl' (\a f -> f a) x fsnum::ParserIntnum = read <$> many1 digitplus::ParserInt->Intplus = dochar '+'x <- numreturn (+x)minus::ParserInt->Intminus = dochar '-'x <- numreturn (subtract x)