結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,956 KB
testcase_01 AC 35 ms
52,000 KB
testcase_02 AC 35 ms
51,944 KB
testcase_03 WA -
testcase_04 AC 36 ms
51,824 KB
testcase_05 AC 36 ms
52,588 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 36 ms
52,556 KB
testcase_09 AC 36 ms
51,880 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 39 ms
51,752 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 35 ms
53,348 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 36 ms
54,108 KB
testcase_29 WA -
testcase_30 AC 36 ms
52,364 KB
testcase_31 WA -
testcase_32 AC 36 ms
53,808 KB
testcase_33 WA -
testcase_34 AC 36 ms
53,100 KB
testcase_35 WA -
testcase_36 AC 35 ms
52,904 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=(X*(N-k-1))%Mod
        Y=(X*pow(k+1,Mod-2,Mod))%Mod
    return X%Mod

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