結果
| 問題 | No.67 よくある棒を切る問題 (1) | 
| コンテスト | |
| ユーザー |  vwxyz | 
| 提出日時 | 2022-06-21 03:37:34 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 653 ms / 5,000 ms | 
| コード長 | 751 bytes | 
| コンパイル時間 | 335 ms | 
| コンパイル使用メモリ | 82,596 KB | 
| 実行使用メモリ | 107,876 KB | 
| 最終ジャッジ日時 | 2025-03-03 12:00:15 | 
| 合計ジャッジ時間 | 11,511 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 30 | 
ソースコード
def Bisect_Int(ok,ng,is_ok):
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if is_ok(mid):
            ok=mid
        else:
            ng=mid
    return ok
def Bisect_Float(ok,ng,is_ok,eps=1e-12,cnt=0):
    if cnt:
        for _ in range(cnt):
            mid=(ok*ng)/2
            if is_ok(mid):
                ok=mid
            else:
                ng=mid
    else:
        while abs(ok-ng)/max(ok,ng,1)>eps:
            mid=(ok+ng)/2
            if is_ok(mid):
                ok=mid
            else:
                ng=mid
    return ok
N=int(input())
L=list(map(int,input().split()))
K=int(input())
def is_ok(x):
    cnt=0
    for l in L:
        cnt+=l//x
    return cnt>=K
ans=Bisect_Float(1e-9,max(L),is_ok,eps=1e-9)
print(ans)
            
            
            
        