結果
問題 | No.2130 分配方法の数え上げ mod 998244353 |
ユーザー |
![]() |
提出日時 | 2024-05-07 14:15:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 516 bytes |
コンパイル時間 | 2,051 ms |
コンパイル使用メモリ | 195,616 KB |
最終ジャッジ日時 | 2025-02-21 11:35:16 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/modint>using namespace std;using mint = atcoder::modint998244353;void fast_io() {ios_base::sync_with_stdio(false);cin.tie(nullptr);}int main() {fast_io();long long n, m;cin >> n >> m;if (n < m) {cout << 0 << endl;return 0;}mint ans = mint(2).pow(n);mint cmb = 1;for (int i = 0; i < m; i++) {ans -= cmb;cmb *= (n - i);cmb /= (i + 1);}cout << ans.val() << endl;}