結果

問題 No.1286 Stone Skipping
ユーザー brthyyjpbrthyyjp
提出日時 2022-01-30 15:32:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 63,872 KB
最終ジャッジ日時 2024-06-11 08:18:06
合計ジャッジ時間 2,479 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

d = int(input())

def f(x, k):
    res = 0
    for i in range(k):
        res += x
        x //= 2
    return res

ans = d
for k in range(1, 65):
    ok = 0
    ng = 10**18+1
    while ok+1 < ng:
        mid = (ok+ng)//2
        if f(mid, k) <= d:
            ok = mid
        else:
            ng = mid
    if f(ok, k) == d:
        ans = min(ans, ok)
print(ans)
0