結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-21 23:31:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 579 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,600 KB
実行使用メモリ 111,496 KB
最終ジャッジ日時 2023-09-22 21:07:03
合計ジャッジ時間 12,657 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
106,212 KB
testcase_01 AC 72 ms
71,396 KB
testcase_02 AC 182 ms
88,168 KB
testcase_03 AC 277 ms
99,572 KB
testcase_04 AC 330 ms
107,524 KB
testcase_05 AC 331 ms
107,628 KB
testcase_06 AC 368 ms
107,760 KB
testcase_07 AC 358 ms
101,052 KB
testcase_08 AC 360 ms
101,108 KB
testcase_09 AC 392 ms
100,868 KB
testcase_10 AC 305 ms
104,060 KB
testcase_11 AC 317 ms
107,392 KB
testcase_12 AC 328 ms
103,876 KB
testcase_13 AC 333 ms
100,636 KB
testcase_14 AC 344 ms
100,304 KB
testcase_15 AC 347 ms
111,496 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import floor
def read_data():
    N = int(input())
    Ls = list(map(int, input().split()))
    K = int(input())
    return N, Ls, K

def solve(N, Ls, K):
    if K == 1:
        return max(Ls)
    eps = 4*10**-9
    lower = max(Ls)/K - eps
    upper = min(sum(Ls)/K, max(Ls)) + eps
    while upper - lower > eps:
#        mid = (upper * lower)**0.5
        mid = (upper + lower) / 2
        if sum(floor(L/mid) for L in Ls) >= K:
            lower = mid
        else:
            upper = mid
    return (upper + lower) / 2

N, Ls, K = read_data()
print(solve(N, Ls, K))
0