結果

問題 No.1869 Doubling?
ユーザー ntuda
提出日時 2022-03-11 23:36:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 196 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 300,672 KB
最終ジャッジ日時 2024-09-16 04:00:20
合計ジャッジ時間 4,226 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
x = pow(2, N - 1)
if x <= M:
    print(x * 2 - 1)
    exit()
cnt = 0
ans = M
while M > 1:
    M = -(-M//2)
    ans += M
    cnt += 1
ans += N - cnt - 1
print(ans)
0