結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー Nikkuniku029Nikkuniku029
提出日時 2022-11-25 22:04:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 75,548 KB
最終ジャッジ日時 2024-04-10 03:13:29
合計ジャッジ時間 3,000 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,920 KB
testcase_01 AC 35 ms
52,504 KB
testcase_02 AC 35 ms
52,140 KB
testcase_03 AC 36 ms
53,116 KB
testcase_04 AC 36 ms
52,824 KB
testcase_05 AC 36 ms
52,500 KB
testcase_06 AC 36 ms
51,996 KB
testcase_07 AC 35 ms
53,084 KB
testcase_08 AC 36 ms
52,404 KB
testcase_09 AC 36 ms
52,528 KB
testcase_10 AC 35 ms
52,120 KB
testcase_11 AC 37 ms
52,328 KB
testcase_12 AC 35 ms
52,252 KB
testcase_13 AC 36 ms
52,288 KB
testcase_14 AC 37 ms
52,704 KB
testcase_15 AC 38 ms
52,660 KB
testcase_16 AC 36 ms
53,356 KB
testcase_17 AC 47 ms
62,736 KB
testcase_18 AC 53 ms
62,068 KB
testcase_19 AC 53 ms
62,732 KB
testcase_20 AC 36 ms
52,236 KB
testcase_21 AC 58 ms
64,376 KB
testcase_22 AC 36 ms
52,476 KB
testcase_23 AC 55 ms
62,716 KB
testcase_24 AC 35 ms
52,616 KB
testcase_25 AC 55 ms
63,200 KB
testcase_26 AC 36 ms
52,772 KB
testcase_27 AC 155 ms
75,548 KB
testcase_28 AC 36 ms
52,548 KB
testcase_29 AC 151 ms
75,476 KB
testcase_30 AC 36 ms
52,460 KB
testcase_31 AC 37 ms
52,676 KB
testcase_32 AC 36 ms
53,080 KB
testcase_33 AC 37 ms
53,168 KB
testcase_34 AC 38 ms
52,824 KB
testcase_35 AC 37 ms
52,340 KB
testcase_36 AC 36 ms
52,544 KB
testcase_37 AC 36 ms
53,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = int(input())
MOD = 998244353


def modinv(x):
    return pow(x, MOD-2, MOD)


ans = pow(2, N, MOD)

tmp = 1
for m in range(M):
    if N >= m:
        if m == 0:
            ans -= 1
        else:
            tmp *= (N-(m-1))
            tmp *= modinv(m)
            tmp %= MOD
            ans -= tmp
    ans %= MOD
print(ans)
0