結果

問題 No.1286 Stone Skipping
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-11-14 09:59:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 82,204 KB
実行使用メモリ 65,136 KB
最終ジャッジ日時 2024-07-23 09:57:29
合計ジャッジ時間 2,296 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

d = int(input())

ans = d

def calc(x,n):
    count = 0
    i = n
    while x and i:
        count += x
        x //= 2
        i -= 1
        if count >= d:
            break
    return count

for i in range(1,70):
    l = 0
    r = d+1
    while r > l + 1:
        m = (r+l)//2
        if calc(m,i) >= d:
            r = m
        else:
            l = m
    if calc(r,i) == d:
        ans = min(ans,r)
print(ans)
0