結果

問題 No.2060 AND Sequence
ユーザー lilictakalilictaka
提出日時 2022-09-02 15:59:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 54,192 KB
最終ジャッジ日時 2024-04-27 16:59:59
合計ジャッジ時間 3,369 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,792 KB
testcase_01 AC 39 ms
52,516 KB
testcase_02 AC 38 ms
52,704 KB
testcase_03 AC 37 ms
53,000 KB
testcase_04 AC 37 ms
53,336 KB
testcase_05 AC 38 ms
52,064 KB
testcase_06 AC 38 ms
52,356 KB
testcase_07 AC 38 ms
52,108 KB
testcase_08 AC 38 ms
52,068 KB
testcase_09 AC 38 ms
52,464 KB
testcase_10 AC 38 ms
52,304 KB
testcase_11 AC 37 ms
52,756 KB
testcase_12 AC 37 ms
53,136 KB
testcase_13 AC 38 ms
52,992 KB
testcase_14 AC 38 ms
52,552 KB
testcase_15 AC 38 ms
52,752 KB
testcase_16 AC 38 ms
53,012 KB
testcase_17 AC 39 ms
52,432 KB
testcase_18 AC 38 ms
53,132 KB
testcase_19 AC 39 ms
54,192 KB
testcase_20 AC 39 ms
52,216 KB
testcase_21 AC 38 ms
52,524 KB
testcase_22 AC 38 ms
52,012 KB
testcase_23 AC 38 ms
53,072 KB
testcase_24 AC 38 ms
52,568 KB
testcase_25 AC 38 ms
53,012 KB
testcase_26 AC 37 ms
52,924 KB
testcase_27 AC 38 ms
52,408 KB
testcase_28 AC 38 ms
53,256 KB
testcase_29 AC 37 ms
52,820 KB
testcase_30 AC 38 ms
53,252 KB
testcase_31 AC 39 ms
51,944 KB
testcase_32 AC 40 ms
53,124 KB
testcase_33 AC 38 ms
53,212 KB
testcase_34 AC 39 ms
52,160 KB
testcase_35 AC 37 ms
52,752 KB
testcase_36 AC 38 ms
53,508 KB
testcase_37 AC 38 ms
53,012 KB
testcase_38 AC 39 ms
52,872 KB
testcase_39 AC 38 ms
52,996 KB
testcase_40 AC 38 ms
53,556 KB
testcase_41 AC 39 ms
51,876 KB
testcase_42 AC 38 ms
53,584 KB
testcase_43 AC 38 ms
53,536 KB
testcase_44 AC 38 ms
52,616 KB
testcase_45 AC 39 ms
52,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
mbin = list(map(int,list(bin(M)[2:])))
cnt = 0
n = len(mbin)
ans = 0
mod = 998244353
for i in range(n):
    if mbin[i] == 1:
        ans += pow(N,cnt,mod) * pow(N+1,n-1-i,mod)
        ans %= mod
        cnt += 1
ans += pow(N,cnt,mod)
ans %= mod
print(ans)
0