結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー hir355hir355
提出日時 2022-11-26 00:12:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 75,676 KB
最終ジャッジ日時 2024-04-10 05:00:41
合計ジャッジ時間 3,095 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,404 KB
testcase_01 AC 37 ms
52,064 KB
testcase_02 AC 38 ms
52,564 KB
testcase_03 AC 36 ms
52,308 KB
testcase_04 AC 37 ms
52,660 KB
testcase_05 AC 37 ms
53,432 KB
testcase_06 AC 36 ms
53,132 KB
testcase_07 AC 37 ms
52,124 KB
testcase_08 AC 38 ms
53,228 KB
testcase_09 AC 37 ms
52,344 KB
testcase_10 AC 36 ms
52,124 KB
testcase_11 AC 40 ms
53,004 KB
testcase_12 AC 36 ms
52,072 KB
testcase_13 AC 36 ms
53,536 KB
testcase_14 AC 37 ms
53,088 KB
testcase_15 AC 36 ms
52,732 KB
testcase_16 AC 38 ms
53,256 KB
testcase_17 AC 46 ms
60,356 KB
testcase_18 AC 53 ms
62,120 KB
testcase_19 AC 52 ms
60,756 KB
testcase_20 AC 36 ms
52,820 KB
testcase_21 AC 54 ms
63,708 KB
testcase_22 AC 37 ms
51,828 KB
testcase_23 AC 54 ms
63,568 KB
testcase_24 AC 37 ms
52,532 KB
testcase_25 AC 54 ms
62,304 KB
testcase_26 AC 37 ms
52,068 KB
testcase_27 AC 156 ms
75,676 KB
testcase_28 AC 35 ms
52,488 KB
testcase_29 AC 153 ms
75,328 KB
testcase_30 AC 37 ms
52,480 KB
testcase_31 AC 37 ms
52,284 KB
testcase_32 AC 37 ms
53,084 KB
testcase_33 AC 37 ms
53,428 KB
testcase_34 AC 36 ms
52,436 KB
testcase_35 AC 36 ms
51,872 KB
testcase_36 AC 36 ms
52,464 KB
testcase_37 AC 36 ms
52,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n = int(input())
m = int(input())
if n < m:
    print(0)
    exit(0)
ans = pow(2, n, MOD)
c = 1
for i in range(m):
    ans -= c
    c *= n - i
    c *= pow(i + 1, MOD - 2, MOD)
    c %= MOD
print(ans % MOD)
0