結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー nanaenanae
提出日時 2017-04-07 14:43:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,165 ms / 5,000 ms
コード長 516 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 82,628 KB
実行使用メモリ 102,376 KB
最終ジャッジ日時 2024-04-25 23:49:46
合計ジャッジ時間 17,980 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 264 ms
102,376 KB
testcase_01 AC 42 ms
58,824 KB
testcase_02 AC 461 ms
73,952 KB
testcase_03 AC 850 ms
86,120 KB
testcase_04 AC 850 ms
91,988 KB
testcase_05 AC 850 ms
91,640 KB
testcase_06 AC 690 ms
91,756 KB
testcase_07 AC 1,163 ms
96,016 KB
testcase_08 AC 1,165 ms
96,064 KB
testcase_09 AC 891 ms
95,752 KB
testcase_10 AC 829 ms
88,456 KB
testcase_11 AC 817 ms
91,212 KB
testcase_12 AC 605 ms
88,400 KB
testcase_13 AC 1,066 ms
94,260 KB
testcase_14 AC 1,108 ms
95,944 KB
testcase_15 AC 780 ms
92,116 KB
testcase_16 AC 398 ms
91,408 KB
testcase_17 AC 352 ms
91,332 KB
testcase_18 AC 297 ms
91,060 KB
testcase_19 AC 355 ms
95,848 KB
testcase_20 AC 323 ms
95,752 KB
testcase_21 AC 271 ms
95,772 KB
testcase_22 AC 275 ms
87,296 KB
testcase_23 AC 285 ms
89,976 KB
testcase_24 AC 38 ms
52,460 KB
testcase_25 AC 71 ms
60,952 KB
testcase_26 AC 55 ms
60,376 KB
testcase_27 AC 49 ms
59,996 KB
testcase_28 AC 233 ms
65,872 KB
testcase_29 AC 147 ms
63,620 KB
testcase_30 AC 72 ms
61,036 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(50):
        mid = (top + btm) / 2

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

    print(btm)

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