結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー しらっ亭しらっ亭
提出日時 2015-08-03 03:48:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,460 ms / 5,000 ms
コード長 420 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 33,276 KB
最終ジャッジ日時 2024-04-25 23:28:16
合計ジャッジ時間 45,980 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,434 ms
33,276 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 883 ms
19,032 KB
testcase_03 AC 1,675 ms
26,512 KB
testcase_04 AC 2,460 ms
29,488 KB
testcase_05 AC 2,449 ms
29,360 KB
testcase_06 AC 2,103 ms
29,352 KB
testcase_07 AC 2,300 ms
32,664 KB
testcase_08 AC 2,280 ms
32,664 KB
testcase_09 AC 2,001 ms
32,660 KB
testcase_10 AC 2,240 ms
27,648 KB
testcase_11 AC 2,338 ms
28,552 KB
testcase_12 AC 1,818 ms
26,968 KB
testcase_13 AC 2,105 ms
31,148 KB
testcase_14 AC 2,210 ms
31,936 KB
testcase_15 AC 1,715 ms
29,276 KB
testcase_16 AC 1,627 ms
29,356 KB
testcase_17 AC 1,554 ms
28,444 KB
testcase_18 AC 1,509 ms
29,356 KB
testcase_19 AC 1,438 ms
32,648 KB
testcase_20 AC 1,441 ms
32,664 KB
testcase_21 AC 1,435 ms
32,664 KB
testcase_22 AC 1,351 ms
27,652 KB
testcase_23 AC 1,420 ms
28,548 KB
testcase_24 AC 29 ms
10,752 KB
testcase_25 AC 78 ms
11,136 KB
testcase_26 AC 48 ms
11,008 KB
testcase_27 AC 42 ms
10,752 KB
testcase_28 AC 408 ms
14,176 KB
testcase_29 AC 223 ms
12,412 KB
testcase_30 AC 80 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N = int(input())
    L = list(map(int, input().split()))
    K = int(input())

    a = 0
    b = max(L)

    EPS = 1e-10
    EPS1 = 1 + EPS

    while b - a > EPS and b > a * EPS1:
        c = (a + b) / 2
        n = sum(int(l / c) for l in L)
        if n >= K:
            a = c
        else:
            b = c

    print((a + b) / 2)


def main():
    solve()


if __name__ == '__main__':
    main()
0