結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー achapiachapi
提出日時 2022-11-25 21:35:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 80,584 KB
最終ジャッジ日時 2024-04-10 02:47:57
合計ジャッジ時間 2,634 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,048 KB
testcase_01 AC 35 ms
52,468 KB
testcase_02 AC 35 ms
53,012 KB
testcase_03 AC 34 ms
53,288 KB
testcase_04 AC 34 ms
52,296 KB
testcase_05 AC 35 ms
53,532 KB
testcase_06 AC 34 ms
52,980 KB
testcase_07 AC 35 ms
51,956 KB
testcase_08 AC 35 ms
53,232 KB
testcase_09 AC 34 ms
52,924 KB
testcase_10 AC 35 ms
52,804 KB
testcase_11 AC 35 ms
52,356 KB
testcase_12 AC 36 ms
52,204 KB
testcase_13 AC 35 ms
52,484 KB
testcase_14 AC 34 ms
53,632 KB
testcase_15 AC 33 ms
51,880 KB
testcase_16 AC 35 ms
52,212 KB
testcase_17 AC 40 ms
59,344 KB
testcase_18 AC 42 ms
61,364 KB
testcase_19 AC 41 ms
60,180 KB
testcase_20 AC 36 ms
53,012 KB
testcase_21 AC 41 ms
62,196 KB
testcase_22 AC 34 ms
53,416 KB
testcase_23 AC 41 ms
61,668 KB
testcase_24 AC 34 ms
53,716 KB
testcase_25 AC 41 ms
61,416 KB
testcase_26 AC 34 ms
52,240 KB
testcase_27 AC 63 ms
80,520 KB
testcase_28 AC 34 ms
52,540 KB
testcase_29 AC 66 ms
80,584 KB
testcase_30 AC 35 ms
53,152 KB
testcase_31 AC 35 ms
53,292 KB
testcase_32 AC 34 ms
53,228 KB
testcase_33 AC 34 ms
52,528 KB
testcase_34 AC 33 ms
53,164 KB
testcase_35 AC 33 ms
52,036 KB
testcase_36 AC 34 ms
52,264 KB
testcase_37 AC 33 ms
51,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
m=int(input())
mod=998244353
if n<m:exit(print(0))
ans=pow(2,n,mod)
def ncr(n, r, mod):
    ret = 1
    s=0
    inv = [1]
    for i in range(1, r+1):
        s+=ret
        s%=mod
        inv.append(max(1, (-(mod//i) * inv[mod % i]) % mod))
        ret = ret*(n+1-i)*inv[i] % mod
    return s
print((ans-max(1,ncr(n,m,mod)))%mod)
0