結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-11-25 22:42:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 72,988 KB
最終ジャッジ日時 2024-04-10 03:53:15
合計ジャッジ時間 2,926 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,196 KB
testcase_01 AC 39 ms
51,872 KB
testcase_02 AC 42 ms
52,324 KB
testcase_03 AC 38 ms
52,876 KB
testcase_04 AC 37 ms
52,456 KB
testcase_05 AC 36 ms
52,528 KB
testcase_06 AC 37 ms
51,984 KB
testcase_07 AC 36 ms
53,492 KB
testcase_08 AC 35 ms
52,376 KB
testcase_09 AC 36 ms
53,212 KB
testcase_10 AC 38 ms
52,676 KB
testcase_11 AC 38 ms
53,212 KB
testcase_12 AC 37 ms
52,120 KB
testcase_13 AC 37 ms
52,960 KB
testcase_14 AC 38 ms
52,092 KB
testcase_15 AC 36 ms
52,924 KB
testcase_16 AC 36 ms
52,452 KB
testcase_17 AC 45 ms
61,508 KB
testcase_18 AC 52 ms
60,192 KB
testcase_19 AC 51 ms
60,668 KB
testcase_20 AC 38 ms
52,480 KB
testcase_21 AC 54 ms
61,212 KB
testcase_22 AC 37 ms
51,884 KB
testcase_23 AC 53 ms
62,268 KB
testcase_24 AC 36 ms
52,200 KB
testcase_25 AC 53 ms
61,112 KB
testcase_26 AC 36 ms
52,000 KB
testcase_27 AC 146 ms
71,876 KB
testcase_28 AC 35 ms
52,336 KB
testcase_29 AC 139 ms
72,988 KB
testcase_30 AC 35 ms
52,444 KB
testcase_31 AC 35 ms
52,484 KB
testcase_32 AC 35 ms
52,684 KB
testcase_33 AC 34 ms
51,936 KB
testcase_34 AC 35 ms
52,180 KB
testcase_35 AC 35 ms
52,080 KB
testcase_36 AC 34 ms
52,824 KB
testcase_37 AC 35 ms
52,680 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