結果

問題 No.70 睡眠の重要性!
ユーザー momen999momen999
提出日時 2017-05-25 18:29:02
言語 Haskell
(9.8.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 457 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 142,512 KB
最終ジャッジ日時 2023-10-19 23:19:27
合計ジャッジ時間 664 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #

import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as B

rInt :: B.ByteString -> Int
rInt = fst . fromJust . B.readInt

sleep [[h1, m1], [h2, m2]] t = (h2' * 60 + m2) - (h1 * 60 + m1) + t
    where
        h2' | (h2 * 60 + m2) < (h1 * 60 + m1)   = h2 + 24
            | otherwise = h2

main = do
    n <- readLn
    times <- map (map (map rInt . (B.split ':')) . B.words) <$> replicateM n B.getLine
    print $ foldr sleep 0 times
0