結果

問題 No.1869 Doubling?
ユーザー SidewaysOwl
提出日時 2022-03-11 21:55:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 233 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-09-16 02:08:08
合計ジャッジ時間 3,309 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
cnt = 0
while 2**cnt < m:
    cnt += 1
if n-1 < cnt:
    ans = 2**n-1
else:
    cnt = 0
    ans = m
    while m != 1:
        m = -(-m//2)
        ans += m
        cnt += 1
    ans += n-cnt-1
print(ans)
0