結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-21 23:52:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 238 ms / 5,000 ms
コード長 632 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 82,764 KB
実行使用メモリ 108,140 KB
最終ジャッジ日時 2024-04-25 23:25:23
合計ジャッジ時間 6,443 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
102,616 KB
testcase_01 AC 37 ms
53,912 KB
testcase_02 AC 89 ms
87,136 KB
testcase_03 AC 131 ms
98,328 KB
testcase_04 AC 164 ms
106,168 KB
testcase_05 AC 163 ms
106,456 KB
testcase_06 AC 190 ms
106,556 KB
testcase_07 AC 172 ms
102,200 KB
testcase_08 AC 170 ms
102,452 KB
testcase_09 AC 198 ms
102,592 KB
testcase_10 AC 151 ms
102,872 KB
testcase_11 AC 159 ms
106,216 KB
testcase_12 AC 171 ms
102,536 KB
testcase_13 AC 149 ms
104,880 KB
testcase_14 AC 158 ms
108,140 KB
testcase_15 AC 170 ms
104,576 KB
testcase_16 AC 234 ms
106,504 KB
testcase_17 AC 238 ms
106,660 KB
testcase_18 AC 223 ms
106,460 KB
testcase_19 AC 237 ms
102,508 KB
testcase_20 AC 226 ms
102,496 KB
testcase_21 AC 226 ms
102,244 KB
testcase_22 AC 75 ms
98,704 KB
testcase_23 AC 220 ms
106,384 KB
testcase_24 AC 35 ms
53,996 KB
testcase_25 AC 43 ms
62,720 KB
testcase_26 AC 42 ms
61,256 KB
testcase_27 AC 42 ms
60,864 KB
testcase_28 AC 61 ms
79,388 KB
testcase_29 AC 48 ms
72,960 KB
testcase_30 AC 43 ms
63,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 = 5*10**-10
    sumLs = sum(Ls)
    maxLs = max(Ls)
    lower = max(maxLs/K, sumLs/(K + N)) - eps
#    lower = maxLs/K - eps
    upper = min(sumLs/K, maxLs) + eps
    while upper - lower > eps and (upper - lower)/lower > eps:
        mid = (upper + lower) / 2
        if sum(int(L/mid) for L in Ls) >= K:
            lower = mid
        else:
            upper = mid
    return (lower + upper)/2


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