結果

問題 No.1286 Stone Skipping
ユーザー H20
提出日時 2020-11-15 16:49:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 59,292 KB
最終ジャッジ日時 2024-07-23 01:16:37
合計ジャッジ時間 2,258 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 11 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#めぐる式二部探索
#参考サイト:https://aotamasaki.hatenablog.com/entry/meguru_bisect

D = int(input())
def is_ok(arg):
    jump = 0
    while arg>0:
        jump += arg
        arg = arg//2
    return jump >= D

def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
ans = meguru_bisect(0,10**18 + 1)

jump = 0
anstemp = ans
while anstemp >0:
    jump += anstemp
    anstemp = anstemp//2

if jump>D: 
    ans+=1

print(ans)
0