結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー しらっ亭しらっ亭
提出日時 2016-02-23 17:04:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,487 ms / 5,000 ms
コード長 419 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 32,792 KB
最終ジャッジ日時 2024-04-25 23:36:18
合計ジャッジ時間 45,997 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,443 ms
32,696 KB
testcase_01 AC 30 ms
10,880 KB
testcase_02 AC 887 ms
19,036 KB
testcase_03 AC 1,670 ms
26,580 KB
testcase_04 AC 2,470 ms
29,360 KB
testcase_05 AC 2,487 ms
29,360 KB
testcase_06 AC 2,100 ms
29,352 KB
testcase_07 AC 2,295 ms
32,664 KB
testcase_08 AC 2,297 ms
32,660 KB
testcase_09 AC 1,993 ms
32,660 KB
testcase_10 AC 2,213 ms
26,564 KB
testcase_11 AC 2,337 ms
28,672 KB
testcase_12 AC 1,805 ms
26,056 KB
testcase_13 AC 2,092 ms
31,288 KB
testcase_14 AC 2,201 ms
31,592 KB
testcase_15 AC 1,719 ms
29,380 KB
testcase_16 AC 1,627 ms
29,360 KB
testcase_17 AC 1,544 ms
29,352 KB
testcase_18 AC 1,505 ms
29,352 KB
testcase_19 AC 1,443 ms
32,792 KB
testcase_20 AC 1,441 ms
32,660 KB
testcase_21 AC 1,444 ms
32,664 KB
testcase_22 AC 1,358 ms
26,704 KB
testcase_23 AC 1,421 ms
28,556 KB
testcase_24 AC 30 ms
10,752 KB
testcase_25 AC 79 ms
11,136 KB
testcase_26 AC 48 ms
10,880 KB
testcase_27 AC 42 ms
10,880 KB
testcase_28 AC 407 ms
14,304 KB
testcase_29 AC 223 ms
12,412 KB
testcase_30 AC 82 ms
11,264 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