結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー aimyaimy
提出日時 2017-06-11 09:13:28
言語 Haskell
(9.8.2)
結果
AC  
実行時間 4,283 ms / 5,000 ms
コード長 562 bytes
コンパイル時間 10,642 ms
コンパイル使用メモリ 180,960 KB
実行使用メモリ 40,128 KB
最終ジャッジ日時 2024-04-25 23:54:21
合計ジャッジ時間 96,378 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,581 ms
40,128 KB
testcase_01 AC 3 ms
6,944 KB
testcase_02 AC 1,471 ms
16,896 KB
testcase_03 AC 2,805 ms
21,380 KB
testcase_04 AC 3,788 ms
19,200 KB
testcase_05 AC 3,756 ms
18,944 KB
testcase_06 AC 3,747 ms
19,072 KB
testcase_07 AC 3,848 ms
37,836 KB
testcase_08 AC 3,890 ms
37,840 KB
testcase_09 AC 3,871 ms
37,576 KB
testcase_10 AC 3,345 ms
18,432 KB
testcase_11 AC 3,505 ms
18,432 KB
testcase_12 AC 3,191 ms
18,304 KB
testcase_13 AC 3,464 ms
36,804 KB
testcase_14 AC 3,606 ms
37,296 KB
testcase_15 AC 3,236 ms
22,416 KB
testcase_16 AC 3,910 ms
18,944 KB
testcase_17 AC 3,877 ms
18,944 KB
testcase_18 AC 3,826 ms
19,072 KB
testcase_19 AC 4,210 ms
37,576 KB
testcase_20 AC 4,283 ms
37,580 KB
testcase_21 AC 4,170 ms
37,716 KB
testcase_22 AC 3,436 ms
18,432 KB
testcase_23 AC 3,617 ms
18,432 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 78 ms
8,960 KB
testcase_26 AC 31 ms
8,448 KB
testcase_27 AC 22 ms
8,192 KB
testcase_28 AC 603 ms
11,008 KB
testcase_29 AC 305 ms
10,368 KB
testcase_30 AC 83 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.readInt) . 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