結果

問題 No.2130 分配方法の数え上げ mod 998244353
ユーザー 👑 tatyam
提出日時 2022-11-25 21:25:48
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 3,181 ms
コンパイル使用メモリ 245,508 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 03:56:13
合計ジャッジ時間 4,364 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;
const ll INF = LLONG_MAX / 4;
#define rep(i,a,b) for(ll i = a; i < b; i++)
template<class T, class U> bool chmax(T& a, U b){ if(a >= b) return 0; a = b; return 1; }


int main(){
    ll N, M;
    cin >> N >> M;
    if(N < M) return puts("0") & 0;
    mint ans = mint{2}.pow(N), c = 1;
    for(ll i = 0; i < M; i++){
        ans -= c;
        c *= N - i;
        c /= i + 1;
    }
    cout << ans.val() << endl;
}
0