結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー 👑 KazunKazun
提出日時 2022-11-25 21:24:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 69,140 KB
最終ジャッジ日時 2024-04-10 02:33:11
合計ジャッジ時間 2,871 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,268 KB
testcase_01 AC 35 ms
52,868 KB
testcase_02 AC 36 ms
52,436 KB
testcase_03 WA -
testcase_04 AC 34 ms
51,880 KB
testcase_05 AC 35 ms
52,500 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 35 ms
52,272 KB
testcase_09 AC 35 ms
52,192 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 36 ms
53,284 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 36 ms
52,068 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 35 ms
52,340 KB
testcase_29 WA -
testcase_30 AC 35 ms
52,900 KB
testcase_31 WA -
testcase_32 AC 37 ms
52,684 KB
testcase_33 WA -
testcase_34 AC 36 ms
53,184 KB
testcase_35 WA -
testcase_36 AC 36 ms
52,520 KB
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N=int(input())
    M=int(input())

    Mod=998244353

    if N<M:
        return 0

    X=pow(2,N,Mod)
    Y=1
    for k in range(M):
        X-=Y
        Y=(Y*(N-k-1))%Mod
        Y=(Y*pow(k+1,Mod-2,Mod))%Mod
    return X%Mod

#==================================================
print(solve())
0