結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-21 23:49:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 30,144 KB
最終ジャッジ日時 2023-09-22 21:08:41
合計ジャッジ時間 21,441 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
30,052 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1,007 ms
29,032 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 945 ms
29,084 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 883 ms
30,048 KB
testcase_21 WA -
testcase_22 AC 74 ms
25,952 KB
testcase_23 WA -
testcase_24 AC 15 ms
7,744 KB
testcase_25 WA -
testcase_26 AC 21 ms
8,432 KB
testcase_27 AC 19 ms
8,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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**-9
    sumLs = sum(Ls)
    maxLs = max(Ls)
#    lower = max(maxLs/K, sumLs/(N + 2 * K)) - 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


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