結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-21 23:28:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 545 bytes
コンパイル時間 1,108 ms
コンパイル使用メモリ 11,000 KB
実行使用メモリ 31,124 KB
最終ジャッジ日時 2023-09-22 21:05:01
合計ジャッジ時間 19,901 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
31,124 KB
testcase_01 AC 16 ms
8,388 KB
testcase_02 AC 378 ms
16,684 KB
testcase_03 AC 704 ms
24,204 KB
testcase_04 AC 943 ms
29,244 KB
testcase_05 AC 946 ms
29,216 KB
testcase_06 AC 986 ms
29,292 KB
testcase_07 AC 952 ms
30,224 KB
testcase_08 AC 959 ms
30,344 KB
testcase_09 AC 1,125 ms
30,328 KB
testcase_10 AC 836 ms
26,100 KB
testcase_11 AC 898 ms
28,524 KB
testcase_12 AC 861 ms
25,596 KB
testcase_13 AC 874 ms
28,852 KB
testcase_14 AC 905 ms
29,348 KB
testcase_15 AC 959 ms
27,012 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
        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