結果

問題 No.1869 Doubling?
ユーザー ShirotsumeShirotsume
提出日時 2022-03-11 22:05:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 79,328 KB
最終ジャッジ日時 2023-10-14 07:14:14
合計ジャッジ時間 5,600 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,348 KB
testcase_01 AC 67 ms
71,608 KB
testcase_02 AC 67 ms
71,416 KB
testcase_03 AC 71 ms
71,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 WA -
testcase_08 AC 67 ms
71,320 KB
testcase_09 AC 67 ms
71,300 KB
testcase_10 AC 66 ms
71,420 KB
testcase_11 AC 65 ms
71,612 KB
testcase_12 AC 65 ms
71,252 KB
testcase_13 AC 67 ms
71,524 KB
testcase_14 AC 64 ms
71,328 KB
testcase_15 AC 64 ms
71,340 KB
testcase_16 AC 65 ms
71,384 KB
testcase_17 AC 66 ms
71,648 KB
testcase_18 AC 66 ms
71,624 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 65 ms
71,120 KB
testcase_25 AC 65 ms
71,372 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 65 ms
71,112 KB
testcase_29 AC 66 ms
71,676 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 63 ms
71,376 KB
testcase_34 AC 64 ms
71,372 KB
testcase_35 AC 63 ms
71,256 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 65 ms
71,432 KB
testcase_39 AC 66 ms
71,404 KB
testcase_40 AC 63 ms
71,460 KB
testcase_41 AC 67 ms
71,372 KB
testcase_42 WA -
testcase_43 AC 66 ms
71,620 KB
testcase_44 AC 65 ms
71,572 KB
testcase_45 AC 66 ms
71,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int,input().split())
if m == 1:
    print(n)
    exit()
maxi = 0
for v in range(m + 1000):
    if 2 ** (v + 1) >= m:
        maxi = v + 1
        break
if maxi >= n:
    ans = 2 ** n - 1
    print(ans)
    exit()
now = 2 ** maxi - m
if now != 0:
    s = bin(now)[2:]
    ans = [2]
    for i in range(len(s)):
        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)
else:
    raise Exception
    
0