結果

問題 No.296 n度寝
ユーザー 情報学生情報学生
提出日時 2019-08-24 12:22:40
言語 Haskell
(9.6.2)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 774 bytes
コンパイル時間 8,156 ms
コンパイル使用メモリ 160,452 KB
実行使用メモリ 7,316 KB
最終ジャッジ日時 2023-08-03 17:58:03
合計ジャッジ時間 2,320 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,280 KB
testcase_01 AC 2 ms
7,180 KB
testcase_02 AC 2 ms
7,220 KB
testcase_03 AC 3 ms
7,260 KB
testcase_04 AC 3 ms
7,200 KB
testcase_05 AC 2 ms
7,308 KB
testcase_06 AC 3 ms
7,220 KB
testcase_07 AC 3 ms
7,236 KB
testcase_08 AC 2 ms
7,192 KB
testcase_09 AC 3 ms
7,184 KB
testcase_10 AC 2 ms
7,268 KB
testcase_11 AC 3 ms
7,200 KB
testcase_12 AC 2 ms
7,316 KB
testcase_13 AC 3 ms
7,200 KB
testcase_14 AC 2 ms
7,164 KB
testcase_15 AC 2 ms
7,284 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/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