結果

問題 No.1869 Doubling?
ユーザー wolgnik
提出日時 2022-03-11 21:44:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 229 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-09-16 01:56:38
合計ジャッジ時間 3,360 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N, M = map(int, input().split())

m = M.bit_length() - 1
if N <= m:
  print(pow(2, N) - 1)
  exit(0)

res = 0
c = 0
while M > 1:
  res += M
  M += 1
  M >>= 1
  c += 1
res += N - c
print(res)
0