結果

問題 No.51 やる気の問題
ユーザー seatofhorse
提出日時 2017-12-20 22:52:21
言語 Haskell
(9.10.1)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 436 bytes
コンパイル時間 9,952 ms
コンパイル使用メモリ 172,800 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-12-16 07:21:27
合計ジャッジ時間 7,310 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

module Main where

import Control.Monad.State

type Work = Int
type Day = Int
type WorkState = (Work, Day)

solve :: State WorkState Work

solve = do
    (work, day) <- get
    let today = work `div` day ^ 2
    if day == 1 
        then return work
        else do
            put (work-today, day-1)
            solve

main :: IO()

main = do
    w <- read <$> getLine
    d <- read <$> getLine
    print $ fst $ runState solve (w,d)
0