結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー nanaenanae
提出日時 2017-04-07 14:20:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,229 ms / 5,000 ms
コード長 517 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 102,176 KB
最終ジャッジ日時 2024-04-25 23:49:27
合計ジャッジ時間 30,981 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 316 ms
102,176 KB
testcase_01 AC 43 ms
58,800 KB
testcase_02 AC 842 ms
76,512 KB
testcase_03 AC 1,606 ms
86,784 KB
testcase_04 AC 1,622 ms
92,380 KB
testcase_05 AC 1,603 ms
92,632 KB
testcase_06 AC 1,271 ms
91,904 KB
testcase_07 AC 2,217 ms
95,864 KB
testcase_08 AC 2,229 ms
95,752 KB
testcase_09 AC 1,672 ms
95,932 KB
testcase_10 AC 1,591 ms
88,944 KB
testcase_11 AC 1,540 ms
90,808 KB
testcase_12 AC 1,106 ms
89,128 KB
testcase_13 AC 2,039 ms
94,232 KB
testcase_14 AC 2,105 ms
96,044 KB
testcase_15 AC 1,457 ms
92,468 KB
testcase_16 AC 700 ms
91,956 KB
testcase_17 AC 606 ms
91,404 KB
testcase_18 AC 539 ms
92,196 KB
testcase_19 AC 617 ms
95,680 KB
testcase_20 AC 572 ms
96,092 KB
testcase_21 AC 458 ms
95,592 KB
testcase_22 AC 465 ms
87,384 KB
testcase_23 AC 474 ms
90,460 KB
testcase_24 AC 39 ms
52,684 KB
testcase_25 AC 95 ms
61,940 KB
testcase_26 AC 64 ms
62,392 KB
testcase_27 AC 56 ms
60,796 KB
testcase_28 AC 411 ms
67,536 KB
testcase_29 AC 245 ms
65,096 KB
testcase_30 AC 96 ms
61,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def solve():
    def check(mid):
        cnt = 0

        for i in range(N):
            cnt += int(L[i] // mid)

            if cnt >= K:
                return True

        return False
    
    N = int(input())
    L = [int(i) for i in input().split()]
    K = int(input())

    btm = 0
    top = sum(L) / K

    for i in range(100):
        mid = (top + btm) / 2

        if check(mid):
            btm = mid
        else:
            top = mid

    print(btm)

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