結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー 👑 tamatotamato
提出日時 2022-11-25 21:24:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 75,308 KB
最終ジャッジ日時 2024-04-10 02:33:35
合計ジャッジ時間 3,191 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,404 KB
testcase_01 AC 36 ms
52,736 KB
testcase_02 AC 35 ms
52,268 KB
testcase_03 AC 34 ms
52,264 KB
testcase_04 AC 34 ms
53,040 KB
testcase_05 AC 34 ms
52,416 KB
testcase_06 AC 38 ms
52,204 KB
testcase_07 AC 33 ms
52,480 KB
testcase_08 AC 32 ms
52,796 KB
testcase_09 AC 34 ms
52,264 KB
testcase_10 AC 34 ms
52,700 KB
testcase_11 AC 33 ms
53,376 KB
testcase_12 AC 33 ms
52,616 KB
testcase_13 AC 33 ms
52,916 KB
testcase_14 AC 33 ms
53,372 KB
testcase_15 AC 35 ms
52,416 KB
testcase_16 AC 33 ms
52,156 KB
testcase_17 AC 42 ms
61,304 KB
testcase_18 AC 51 ms
61,092 KB
testcase_19 AC 48 ms
61,888 KB
testcase_20 AC 36 ms
53,408 KB
testcase_21 AC 50 ms
63,880 KB
testcase_22 AC 32 ms
52,956 KB
testcase_23 AC 49 ms
61,768 KB
testcase_24 AC 35 ms
53,156 KB
testcase_25 AC 51 ms
60,972 KB
testcase_26 AC 34 ms
52,024 KB
testcase_27 AC 144 ms
75,076 KB
testcase_28 AC 34 ms
53,912 KB
testcase_29 AC 143 ms
75,308 KB
testcase_30 AC 34 ms
53,020 KB
testcase_31 AC 34 ms
53,636 KB
testcase_32 AC 34 ms
52,404 KB
testcase_33 AC 34 ms
52,080 KB
testcase_34 AC 34 ms
53,288 KB
testcase_35 AC 35 ms
52,188 KB
testcase_36 AC 33 ms
52,080 KB
testcase_37 AC 32 ms
53,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

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

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


if __name__ == '__main__':
    main()
0