結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー 👑 KazunKazun
提出日時 2022-11-25 21:25:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 68,940 KB
最終ジャッジ日時 2024-04-10 02:35:55
合計ジャッジ時間 3,051 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,892 KB
testcase_01 AC 39 ms
53,508 KB
testcase_02 AC 35 ms
53,164 KB
testcase_03 AC 36 ms
52,184 KB
testcase_04 AC 36 ms
52,404 KB
testcase_05 AC 36 ms
53,348 KB
testcase_06 AC 36 ms
53,564 KB
testcase_07 AC 37 ms
53,604 KB
testcase_08 AC 37 ms
52,676 KB
testcase_09 AC 35 ms
53,260 KB
testcase_10 AC 38 ms
52,708 KB
testcase_11 AC 36 ms
52,612 KB
testcase_12 AC 36 ms
52,560 KB
testcase_13 AC 36 ms
53,576 KB
testcase_14 AC 37 ms
52,812 KB
testcase_15 AC 36 ms
53,036 KB
testcase_16 AC 36 ms
52,060 KB
testcase_17 AC 44 ms
58,224 KB
testcase_18 AC 50 ms
57,820 KB
testcase_19 AC 47 ms
58,160 KB
testcase_20 AC 37 ms
52,820 KB
testcase_21 AC 51 ms
59,224 KB
testcase_22 AC 37 ms
52,280 KB
testcase_23 AC 49 ms
59,812 KB
testcase_24 AC 37 ms
51,996 KB
testcase_25 AC 50 ms
59,740 KB
testcase_26 AC 37 ms
52,680 KB
testcase_27 AC 131 ms
68,012 KB
testcase_28 AC 35 ms
52,680 KB
testcase_29 AC 134 ms
68,940 KB
testcase_30 AC 36 ms
53,088 KB
testcase_31 AC 34 ms
53,148 KB
testcase_32 AC 35 ms
52,456 KB
testcase_33 AC 36 ms
52,608 KB
testcase_34 AC 37 ms
52,472 KB
testcase_35 AC 36 ms
52,820 KB
testcase_36 AC 35 ms
52,348 KB
testcase_37 AC 36 ms
52,340 KB
権限があれば一括ダウンロードができます

ソースコード

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))%Mod
        Y=(Y*pow(k+1,Mod-2,Mod))%Mod
    return X%Mod

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