結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-11-25 23:14:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 75,504 KB
最終ジャッジ日時 2024-04-10 04:19:31
合計ジャッジ時間 2,994 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,324 KB
testcase_01 AC 35 ms
51,824 KB
testcase_02 AC 35 ms
52,900 KB
testcase_03 AC 34 ms
53,836 KB
testcase_04 AC 34 ms
52,504 KB
testcase_05 AC 34 ms
52,324 KB
testcase_06 AC 35 ms
52,480 KB
testcase_07 AC 34 ms
52,956 KB
testcase_08 AC 35 ms
51,872 KB
testcase_09 AC 35 ms
52,644 KB
testcase_10 AC 34 ms
52,756 KB
testcase_11 AC 34 ms
51,884 KB
testcase_12 AC 38 ms
52,488 KB
testcase_13 AC 34 ms
52,524 KB
testcase_14 AC 35 ms
52,560 KB
testcase_15 AC 34 ms
52,896 KB
testcase_16 AC 36 ms
52,424 KB
testcase_17 AC 44 ms
60,600 KB
testcase_18 AC 54 ms
63,384 KB
testcase_19 AC 51 ms
62,080 KB
testcase_20 AC 36 ms
51,940 KB
testcase_21 AC 53 ms
62,676 KB
testcase_22 AC 35 ms
52,276 KB
testcase_23 AC 52 ms
61,888 KB
testcase_24 AC 35 ms
52,752 KB
testcase_25 AC 52 ms
62,528 KB
testcase_26 AC 36 ms
52,356 KB
testcase_27 AC 153 ms
75,504 KB
testcase_28 AC 36 ms
52,404 KB
testcase_29 AC 149 ms
75,328 KB
testcase_30 AC 35 ms
51,980 KB
testcase_31 AC 34 ms
52,956 KB
testcase_32 AC 34 ms
52,528 KB
testcase_33 AC 34 ms
52,728 KB
testcase_34 AC 35 ms
52,208 KB
testcase_35 AC 34 ms
53,212 KB
testcase_36 AC 33 ms
52,768 KB
testcase_37 AC 34 ms
53,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
m = int(input())
mod = 998244353

if n < m:
    print(0)
    exit()
    
ans = pow(2,n,mod)-1
nCr = 1
for i in range(m-1):
    nCr *= n-i
    nCr *= pow(1+i,mod-2,mod)
    nCr %= mod
    ans -= nCr
    ans %= mod
print(ans)
0