結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー aimyaimy
提出日時 2017-06-11 08:50:19
言語 Haskell
(9.8.2)
結果
AC  
実行時間 4,566 ms / 5,000 ms
コード長 580 bytes
コンパイル時間 3,428 ms
コンパイル使用メモリ 192,128 KB
実行使用メモリ 36,684 KB
最終ジャッジ日時 2024-04-25 23:57:33
合計ジャッジ時間 99,511 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,993 ms
25,920 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 1,585 ms
16,640 KB
testcase_03 AC 3,027 ms
21,252 KB
testcase_04 AC 3,990 ms
18,816 KB
testcase_05 AC 3,993 ms
18,944 KB
testcase_06 AC 3,980 ms
19,200 KB
testcase_07 AC 4,187 ms
36,560 KB
testcase_08 AC 4,176 ms
36,684 KB
testcase_09 AC 4,180 ms
36,552 KB
testcase_10 AC 3,568 ms
18,304 KB
testcase_11 AC 3,783 ms
18,432 KB
testcase_12 AC 3,521 ms
18,176 KB
testcase_13 AC 3,806 ms
36,172 KB
testcase_14 AC 3,955 ms
36,540 KB
testcase_15 AC 3,587 ms
22,412 KB
testcase_16 AC 4,235 ms
19,200 KB
testcase_17 AC 4,179 ms
19,072 KB
testcase_18 AC 4,141 ms
19,200 KB
testcase_19 AC 4,566 ms
36,684 KB
testcase_20 AC 4,559 ms
36,564 KB
testcase_21 AC 4,549 ms
36,552 KB
testcase_22 AC 3,724 ms
18,304 KB
testcase_23 AC 3,935 ms
18,560 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 84 ms
8,704 KB
testcase_26 AC 33 ms
8,320 KB
testcase_27 AC 25 ms
8,320 KB
testcase_28 AC 668 ms
11,008 KB
testcase_29 AC 333 ms
10,368 KB
testcase_30 AC 89 ms
8,960 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Data.Fixed
import Text.Printf
import Data.Maybe
import qualified Data.ByteString.Char8 as B

apply n f x = foldr ($) x (replicate n f)

lmin = 0 :: Pico
lmax = 10e9 :: Pico
eps = 10e-10 :: Pico

main = do
 getLine
 ls <- map (fromIntegral . fst . fromJust . B.readInt) . B.words <$> B.getLine :: IO [Pico]
 k <- readLn
 putStrLn $ showFixed True (yokuaru k ls)

yokuaru k ls = snd (until (\(x,y) -> y-x < eps) (bsearch k ls) (lmin,lmax))

bsearch k ls (lo,hi)
 | cuts md ls < k = (lo,md)
 | otherwise = (md,hi)
 where
  md = (lo + hi) / 2

cuts x = sum . map (floor . (/x))
0