結果
問題 | No.2299 Antitypoglycemia |
ユーザー |
![]() |
提出日時 | 2024-11-08 00:41:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 2,002 ms |
コンパイル使用メモリ | 197,668 KB |
最終ジャッジ日時 | 2025-02-25 02:31:36 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include <atcoder/modint> using mint = atcoder::modint998244353; int main() { fast_io(); int n, a, b; cin >> n >> a >> b; vector<mint> facts(n + 1); facts[0] = 1; for (int i = 1; i <= n; i++) { facts[i] = facts[i - 1] * i; } mint ans = facts[n] - 2 * facts[n - 1]; if (a != b) { ans += facts[n - 2]; } cout << ans.val() << endl; }