結果

問題 No.1869 Doubling?
ユーザー ShirotsumeShirotsume
提出日時 2022-03-11 21:52:22
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 366 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 80,104 KB
最終ジャッジ日時 2023-10-14 06:58:35
合計ジャッジ時間 7,428 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,680 KB
testcase_01 AC 90 ms
71,504 KB
testcase_02 AC 90 ms
71,508 KB
testcase_03 AC 93 ms
71,556 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 93 ms
71,532 KB
testcase_09 WA -
testcase_10 AC 92 ms
71,456 KB
testcase_11 RE -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 AC 89 ms
71,940 KB
testcase_16 AC 91 ms
71,672 KB
testcase_17 AC 91 ms
71,548 KB
testcase_18 AC 93 ms
71,768 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 91 ms
71,688 KB
testcase_25 AC 90 ms
71,760 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 91 ms
71,504 KB
testcase_29 AC 93 ms
71,456 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 91 ms
71,960 KB
testcase_34 AC 91 ms
71,600 KB
testcase_35 AC 94 ms
71,764 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 92 ms
71,524 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 AC 93 ms
71,608 KB
testcase_44 WA -
testcase_45 AC 94 ms
71,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n, m = map(int,input().split())
maxi = 0
for v in range(n):
    if 2 ** (v + 1) > m:
        maxi = v + 1
        break

now = 2 ** maxi - m


s = bin(now)[2:]
ans = [2]
for i in range(maxi - 1):
    if s[i] == '1':
        ans.append(2 * ans[-1] - 1)
    else:
        ans.append(2 * ans[-1])
l = n - len(s)
print(sum(ans) + l - 1)

0