結果

問題 No.296 n度寝
ユーザー 情報学生
提出日時 2019-08-24 12:22:40
言語 Haskell
(9.10.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 774 bytes
コンパイル時間 1,785 ms
コンパイル使用メモリ 180,908 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 15:03:55
合計ジャッジ時間 2,367 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeApplications #-}

import Control.Applicative ((<$>))
import Data.Char (isSpace)
import Data.List (unfoldr)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B

getL :: (ByteString -> [Int]) -> IO [Int]
getL f = f <$> B.getLine

readIL :: (ByteString -> Maybe (Int, ByteString)) -> (ByteString -> [Int])
readIL f = unfoldr g
    where
        g s = do
            (n, s') <- f s
            return (n, B.dropWhile isSpace s')

main :: IO ()
main = putStr =<< unlines . solve <$> getL (readIL B.readInt)

solve :: [Int] -> [String]
solve [n, h, m, t] = [x, y]
    where
        p = (n - 1) * t + m
        (a, b) = p `divMod` 60
        c = (a + h) `mod` 24
        x = show c
        y = show b
0