結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー roarisroaris
提出日時 2022-11-25 21:28:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 82,524 KB
実行使用メモリ 73,332 KB
最終ジャッジ日時 2024-04-10 02:39:25
合計ジャッジ時間 3,139 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
54,372 KB
testcase_01 AC 39 ms
53,916 KB
testcase_02 AC 40 ms
55,136 KB
testcase_03 AC 40 ms
54,124 KB
testcase_04 AC 36 ms
55,080 KB
testcase_05 AC 37 ms
53,636 KB
testcase_06 AC 38 ms
54,600 KB
testcase_07 AC 37 ms
55,648 KB
testcase_08 AC 38 ms
53,944 KB
testcase_09 AC 38 ms
53,996 KB
testcase_10 AC 38 ms
54,488 KB
testcase_11 AC 40 ms
54,496 KB
testcase_12 AC 39 ms
54,336 KB
testcase_13 AC 38 ms
54,860 KB
testcase_14 AC 41 ms
54,836 KB
testcase_15 AC 39 ms
54,620 KB
testcase_16 AC 38 ms
54,108 KB
testcase_17 AC 46 ms
62,640 KB
testcase_18 AC 52 ms
61,924 KB
testcase_19 AC 53 ms
61,784 KB
testcase_20 AC 37 ms
54,716 KB
testcase_21 AC 56 ms
65,012 KB
testcase_22 AC 39 ms
54,060 KB
testcase_23 AC 54 ms
62,808 KB
testcase_24 AC 39 ms
54,464 KB
testcase_25 AC 55 ms
63,948 KB
testcase_26 AC 38 ms
54,548 KB
testcase_27 AC 147 ms
73,204 KB
testcase_28 AC 37 ms
53,632 KB
testcase_29 AC 146 ms
73,332 KB
testcase_30 AC 38 ms
53,564 KB
testcase_31 AC 39 ms
54,500 KB
testcase_32 AC 39 ms
54,024 KB
testcase_33 AC 40 ms
54,396 KB
testcase_34 AC 39 ms
54,328 KB
testcase_35 AC 38 ms
53,284 KB
testcase_36 AC 39 ms
54,292 KB
testcase_37 AC 39 ms
54,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

MOD = 998244353

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

if N<M:
    print(0)
    exit()
    
ans = pow(2, N, MOD)
sub = 1

for i in range(M):
    ans -= sub
    ans %= MOD
    sub *= N-i
    sub %= MOD
    sub *= pow(i+1, MOD-2, MOD)
    sub %= MOD

print(ans)
0