結果
問題 | No.430 文字列検索 |
ユーザー | aimy |
提出日時 | 2017-05-17 10:16:02 |
言語 | Haskell (9.8.2) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 333 bytes |
コンパイル時間 | 425 ms |
コンパイル使用メモリ | 142,460 KB |
最終ジャッジ日時 | 2023-10-17 14:40:55 |
合計ジャッジ時間 | 1,023 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:3: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. | 3 | import qualified Data.ByteString.Char8 as B | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
import Control.Monad import Data.List import qualified Data.ByteString.Char8 as B main = do s <- B.getLine getLine cs <- B.lines <$> B.getContents print (searchString s cs) searchString s = sum . map (match s) match s c = length $ filter id $ unfoldr (\s' -> guard (not (B.null s')) >> return (B.isPrefixOf c s', B.tail s')) s