結果

問題 No.23 技の選択
ユーザー tottoripapertottoripaper
提出日時 2014-11-16 11:02:15
言語 Haskell
(9.10.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 382 bytes
コンパイル時間 8,296 ms
コンパイル使用メモリ 172,288 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 16:45:25
合計ジャッジ時間 9,415 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

import Control.Applicative
import Text.Printf

main = do
  [h, a, d] <- map read . words <$> getLine
  let
    max_k = (h+a-1) `div` a
    f :: Int -> Double
    f h'
      | h' <= 0 = 0
      | otherwise = 3 / 2 * (fromIntegral l)
      where
        l = (h'+d-1) `div` d
    mn = minimum $ map (\t -> fromIntegral t + f (h-a*t)) [0..max_k]
   in printf "%.3f\n" mn
0