結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,420 KB
testcase_01 AC 37 ms
52,228 KB
testcase_02 AC 36 ms
52,952 KB
testcase_03 AC 36 ms
52,336 KB
testcase_04 AC 36 ms
53,068 KB
testcase_05 AC 36 ms
52,676 KB
testcase_06 AC 37 ms
52,388 KB
testcase_07 AC 36 ms
52,096 KB
testcase_08 AC 38 ms
51,756 KB
testcase_09 AC 37 ms
52,368 KB
testcase_10 AC 37 ms
52,580 KB
testcase_11 AC 37 ms
52,216 KB
testcase_12 AC 37 ms
51,876 KB
testcase_13 AC 36 ms
52,884 KB
testcase_14 AC 37 ms
53,344 KB
testcase_15 AC 38 ms
52,904 KB
testcase_16 AC 37 ms
53,560 KB
testcase_17 AC 46 ms
60,052 KB
testcase_18 AC 51 ms
60,688 KB
testcase_19 AC 52 ms
60,004 KB
testcase_20 AC 37 ms
52,728 KB
testcase_21 AC 54 ms
60,652 KB
testcase_22 AC 36 ms
52,208 KB
testcase_23 AC 54 ms
61,176 KB
testcase_24 AC 37 ms
52,376 KB
testcase_25 AC 54 ms
61,992 KB
testcase_26 AC 36 ms
53,548 KB
testcase_27 AC 145 ms
71,160 KB
testcase_28 AC 37 ms
51,744 KB
testcase_29 AC 146 ms
71,472 KB
testcase_30 AC 37 ms
53,220 KB
testcase_31 AC 36 ms
52,204 KB
testcase_32 AC 37 ms
51,960 KB
testcase_33 AC 36 ms
53,564 KB
testcase_34 AC 37 ms
52,308 KB
testcase_35 AC 36 ms
52,216 KB
testcase_36 AC 36 ms
51,984 KB
testcase_37 AC 35 ms
52,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = int(input())

mod = 998244353
res = pow(2,N,mod)

ncr = 1
for i in range(M):
    res -= ncr
    res %= mod
    ncr *= ((N-i)*pow(i+1,mod-2,mod))%mod
    ncr %= mod
print(res)

0