結果

問題 No.2130 分配方法の数え上げ mod 998244353
コンテスト
ユーザー hitonanode
提出日時 2022-11-25 23:55:08
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 367 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 958 ms
コンパイル使用メモリ 150,024 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-18 16:16:40
合計ジャッジ時間 2,154 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;
#include <atcoder/modint>
using mint = atcoder::modint998244353;

int main() {
    long long N, M;
    cin >> N >> M;
    if (N < M) {
        puts("0");
        return 0;
    }
    mint ret = mint(2).pow(N), tmp = 1;
    for (int t = 0; t < M; ++t) ret -= tmp, tmp = tmp / (t + 1) * (N - t);
    cout << ret.val() << endl;
}
0