結果

問題 No.67 よくある棒を切る問題 (1)
ユーザー cmycmy
提出日時 2023-06-04 10:37:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 226 ms / 5,000 ms
コード長 458 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 87,516 KB
実行使用メモリ 110,484 KB
最終ジャッジ日時 2023-08-28 08:11:20
合計ジャッジ時間 9,499 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 224 ms
104,672 KB
testcase_01 AC 85 ms
76,412 KB
testcase_02 AC 128 ms
89,484 KB
testcase_03 AC 187 ms
105,072 KB
testcase_04 AC 224 ms
107,432 KB
testcase_05 AC 225 ms
107,656 KB
testcase_06 AC 226 ms
107,684 KB
testcase_07 AC 225 ms
105,072 KB
testcase_08 AC 224 ms
105,080 KB
testcase_09 AC 223 ms
105,000 KB
testcase_10 AC 210 ms
110,484 KB
testcase_11 AC 219 ms
109,436 KB
testcase_12 AC 197 ms
107,152 KB
testcase_13 AC 209 ms
102,248 KB
testcase_14 AC 218 ms
104,500 KB
testcase_15 AC 203 ms
101,796 KB
testcase_16 AC 223 ms
107,672 KB
testcase_17 AC 223 ms
107,664 KB
testcase_18 AC 221 ms
107,600 KB
testcase_19 AC 220 ms
105,160 KB
testcase_20 AC 224 ms
105,016 KB
testcase_21 AC 225 ms
104,932 KB
testcase_22 AC 212 ms
110,428 KB
testcase_23 AC 222 ms
109,704 KB
testcase_24 AC 75 ms
72,076 KB
testcase_25 AC 81 ms
76,640 KB
testcase_26 AC 80 ms
76,612 KB
testcase_27 AC 80 ms
76,356 KB
testcase_28 AC 100 ms
80,740 KB
testcase_29 AC 87 ms
77,056 KB
testcase_30 AC 79 ms
76,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import log2


def judge(x):
    cnt = 0
    for li in L:
        cnt += int(li / x)
    return cnt >= K


def main():
    ok = 1e-9
    ng = 10**9+1
    # 許容誤差
    error = 10**(-9)

    for _ in range(int(log2(abs(ok - ng)/error)) + 2):
        mid = (ok + ng) / 2
        if judge(mid):
            ok = mid
        else:
            ng = mid
    return ok


N = int(input())
*L, = map(int, input().split())
K = int(input())
print(main())
0