結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー aimyaimy
提出日時 2017-05-17 13:49:46
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 498 bytes
コンパイル時間 8,679 ms
コンパイル使用メモリ 163,744 KB
実行使用メモリ 113,824 KB
最終ジャッジ日時 2023-10-17 14:47:40
合計ジャッジ時間 79,627 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,099 ms
113,824 KB
testcase_01 WA -
testcase_02 AC 1,244 ms
37,024 KB
testcase_03 AC 2,316 ms
66,720 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2,676 ms
66,720 KB
testcase_07 AC 3,268 ms
99,488 KB
testcase_08 AC 3,256 ms
99,488 KB
testcase_09 AC 3,388 ms
99,488 KB
testcase_10 WA -
testcase_11 AC 2,487 ms
65,696 KB
testcase_12 AC 2,306 ms
61,600 KB
testcase_13 AC 2,947 ms
87,664 KB
testcase_14 AC 3,078 ms
92,320 KB
testcase_15 AC 2,806 ms
78,768 KB
testcase_16 AC 2,616 ms
66,720 KB
testcase_17 AC 2,627 ms
66,720 KB
testcase_18 AC 2,736 ms
66,720 KB
testcase_19 AC 3,378 ms
99,488 KB
testcase_20 AC 3,278 ms
99,488 KB
testcase_21 AC 3,328 ms
99,488 KB
testcase_22 AC 2,367 ms
63,648 KB
testcase_23 AC 2,445 ms
65,696 KB
testcase_24 AC 3 ms
5,552 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 513 ms
22,960 KB
testcase_29 WA -
testcase_30 AC 72 ms
11,388 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.Ratio
import Text.Printf

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

lmin = 0
lmax = 10e9
nbs = 50

main = do
 getLine
 ls <- map (fromIntegral . read) . words <$> getLine
 k <- readLn
 printf "%.12f" (yokuaru k ls)

yokuaru :: Integer -> [Ratio Integer] -> Double
yokuaru k ls = fromRational (fst (apply nbs (bsearch k ls) (1,(lmin,lmax))))

bsearch k ls (x,(xn,xx))
 | cuts x ls < k = (x - (x-xn) / 2, (xn,x))
 | otherwise = (x + (xx-x) / 2, (x,xx))

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