結果

問題 No.1869 Doubling?
ユーザー qwewe
提出日時 2025-04-24 12:22:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 223 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 82,044 KB
実行使用メモリ 53,672 KB
最終ジャッジ日時 2025-04-24 12:24:28
合計ジャッジ時間 3,549 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())

if M == 1:
    print(N)
else:
    t = (M - 1).bit_length()
    s = bin(M - 1).count('1')
    sum_first = 2 * (M - 1) - s + t
    sum_second = max(0, N - t)
    print(sum_first + sum_second)
0