結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー aimyaimy
提出日時 2017-06-11 08:45:15
言語 Haskell
(9.8.2)
結果
AC  
実行時間 4,410 ms / 5,000 ms
コード長 580 bytes
コンパイル時間 2,385 ms
コンパイル使用メモリ 192,384 KB
実行使用メモリ 37,580 KB
最終ジャッジ日時 2024-04-27 02:28:17
合計ジャッジ時間 94,665 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,820 ms
25,920 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1,509 ms
16,384 KB
testcase_03 AC 2,879 ms
21,248 KB
testcase_04 AC 3,841 ms
19,072 KB
testcase_05 AC 3,837 ms
19,072 KB
testcase_06 AC 3,809 ms
18,944 KB
testcase_07 AC 3,986 ms
36,552 KB
testcase_08 AC 3,997 ms
36,688 KB
testcase_09 AC 4,083 ms
36,812 KB
testcase_10 AC 3,578 ms
18,432 KB
testcase_11 AC 3,734 ms
18,432 KB
testcase_12 AC 3,373 ms
18,304 KB
testcase_13 AC 3,678 ms
36,300 KB
testcase_14 AC 3,814 ms
36,540 KB
testcase_15 AC 3,427 ms
22,416 KB
testcase_16 AC 4,101 ms
20,736 KB
testcase_17 AC 4,033 ms
18,944 KB
testcase_18 AC 4,026 ms
19,072 KB
testcase_19 AC 4,367 ms
37,576 KB
testcase_20 AC 4,410 ms
36,816 KB
testcase_21 AC 4,369 ms
37,580 KB
testcase_22 AC 3,655 ms
18,176 KB
testcase_23 AC 3,770 ms
18,560 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 81 ms
8,704 KB
testcase_26 AC 35 ms
8,576 KB
testcase_27 AC 25 ms
8,448 KB
testcase_28 AC 642 ms
10,752 KB
testcase_29 AC 316 ms
10,240 KB
testcase_30 AC 84 ms
8,704 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-12 :: 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