結果

問題 No.63 ポッキーゲーム
ユーザー tk55513tk55513
提出日時 2020-12-21 02:30:10
言語 Haskell
(9.8.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 959 bytes
コンパイル時間 3,331 ms
コンパイル使用メモリ 142,008 KB
最終ジャッジ日時 2023-10-21 11:26:33
合計ジャッジ時間 3,854 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:4: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.
  |
4 | import qualified Data.ByteString.Char8 as BS
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Main.hs:5:1: error:
    Could not load module ‘Data.Time’
    It is a member of the hidden package ‘time-1.12.2’.
    You can run ‘:set -package time’ 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.
  |
5 | import Data.Time
  | ^^^^^^^^^^^^^^^^

Main.hs:6:1: error:
    Could not load module ‘Data.Time.Calendar’
    It is a member of the hidden package ‘time-1.12.2’.
    You can run ‘:set -package time’ 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.
  |
6 | import Data.Time.Calendar
  | ^^^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #

import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.Time
import Data.Time.Calendar
import Data.Char

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt = fst . fromJust . BS.readInteger
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents

p :: (Show a)=>a->IO ()
p=putStrLn.show
ps=putStrLn

main=do
    [l,k]<-map (read::String->Int).words<$>getLine
    let (d,m)=divMod l (2*k)
    putStrLn.show$(if (m==0) then (d-1)*k else d*k)

0