結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-11-25 22:42:47
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 1,741 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 76,680 KB
最終ジャッジ日時 2023-07-25 10:53:40
合計ジャッジ時間 5,342 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,476 KB
testcase_01 AC 74 ms
71,228 KB
testcase_02 AC 76 ms
71,500 KB
testcase_03 AC 77 ms
71,076 KB
testcase_04 AC 75 ms
71,252 KB
testcase_05 AC 76 ms
71,196 KB
testcase_06 AC 74 ms
71,444 KB
testcase_07 AC 74 ms
71,324 KB
testcase_08 AC 75 ms
71,440 KB
testcase_09 AC 75 ms
71,136 KB
testcase_10 AC 75 ms
71,396 KB
testcase_11 AC 77 ms
71,192 KB
testcase_12 AC 75 ms
71,364 KB
testcase_13 AC 75 ms
71,148 KB
testcase_14 AC 76 ms
71,260 KB
testcase_15 AC 77 ms
71,320 KB
testcase_16 AC 77 ms
70,988 KB
testcase_17 AC 90 ms
76,068 KB
testcase_18 AC 92 ms
75,876 KB
testcase_19 AC 93 ms
76,160 KB
testcase_20 AC 76 ms
71,260 KB
testcase_21 AC 92 ms
76,224 KB
testcase_22 AC 76 ms
71,284 KB
testcase_23 AC 93 ms
75,992 KB
testcase_24 AC 75 ms
71,448 KB
testcase_25 AC 94 ms
76,344 KB
testcase_26 AC 77 ms
71,036 KB
testcase_27 AC 183 ms
76,608 KB
testcase_28 AC 78 ms
71,224 KB
testcase_29 AC 177 ms
76,680 KB
testcase_30 AC 73 ms
71,220 KB
testcase_31 AC 74 ms
71,224 KB
testcase_32 AC 74 ms
71,324 KB
testcase_33 AC 75 ms
71,364 KB
testcase_34 AC 74 ms
71,356 KB
testcase_35 AC 76 ms
71,228 KB
testcase_36 AC 75 ms
71,384 KB
testcase_37 AC 76 ms
71,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
m = int(input())
mod = 998244353 
ans = pow(2,n,mod)-1
acc1 = n
acc2 = 1
# print(ans)
for i in range(1,min(m,n+1)):
#     print(i,acc1,acc2)
    ans -= acc1 * pow(acc2,mod-2,mod)
    acc1 *= n-i
    acc2 *= (i+1)
    acc1 %= mod
    acc2 %= mod
    ans %= mod
#     print(acc1,acc2)
print(ans)
0