結果

問題 No.1286 Stone Skipping
ユーザー rlangevin
提出日時 2023-04-05 08:52:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,648 KB
実行使用メモリ 64,000 KB
最終ジャッジ日時 2024-10-01 20:44:38
合計ジャッジ時間 3,102 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(m, k):
    now = m
    x = 0
    for _ in range(k):
        x += now
        now //= 2
    return x

D = int(input())
inf = 10 ** 18
ans = inf
for k in range(1, 66):
    yes = inf
    no = 0
    while yes - no != 1:
        mid = (yes + no)//2
        if check(mid, k) >= D:
            yes = mid
        else:
            no = mid
    if check(yes, k) == D:
        ans = min(ans, yes)

print(ans)
0