結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー aimyaimy
提出日時 2017-06-11 23:16:24
言語 Haskell
(9.8.2)
結果
AC  
実行時間 4,075 ms / 5,000 ms
コード長 566 bytes
コンパイル時間 4,823 ms
コンパイル使用メモリ 181,076 KB
実行使用メモリ 40,244 KB
最終ジャッジ日時 2024-04-26 00:00:03
合計ジャッジ時間 91,642 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,581 ms
40,244 KB
testcase_01 AC 3 ms
6,944 KB
testcase_02 AC 1,449 ms
16,768 KB
testcase_03 AC 2,758 ms
21,368 KB
testcase_04 AC 3,726 ms
19,072 KB
testcase_05 AC 3,747 ms
18,944 KB
testcase_06 AC 3,691 ms
19,200 KB
testcase_07 AC 3,848 ms
37,696 KB
testcase_08 AC 3,860 ms
37,832 KB
testcase_09 AC 3,744 ms
37,568 KB
testcase_10 AC 3,274 ms
18,560 KB
testcase_11 AC 3,471 ms
18,304 KB
testcase_12 AC 3,099 ms
18,176 KB
testcase_13 AC 3,434 ms
36,540 KB
testcase_14 AC 3,527 ms
37,292 KB
testcase_15 AC 3,175 ms
22,520 KB
testcase_16 AC 3,764 ms
19,200 KB
testcase_17 AC 3,703 ms
19,200 KB
testcase_18 AC 3,657 ms
18,944 KB
testcase_19 AC 4,075 ms
37,576 KB
testcase_20 AC 3,996 ms
37,820 KB
testcase_21 AC 4,027 ms
37,564 KB
testcase_22 AC 3,340 ms
18,176 KB
testcase_23 AC 3,501 ms
18,688 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 77 ms
9,088 KB
testcase_26 AC 29 ms
8,576 KB
testcase_27 AC 22 ms
8,192 KB
testcase_28 AC 591 ms
10,880 KB
testcase_29 AC 294 ms
10,368 KB
testcase_30 AC 79 ms
8,832 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 = 1e-9 :: Pico
lmax = 1e9 :: Pico
eps = 1e-10 :: Pico

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

yokuaru k ls = snd $ apply 60 (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