結果
問題 | No.2299 Antitypoglycemia |
ユーザー |
![]() |
提出日時 | 2023-05-12 21:40:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 673 bytes |
コンパイル時間 | 768 ms |
コンパイル使用メモリ | 105,804 KB |
最終ジャッジ日時 | 2025-02-12 22:21:28 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream> #include <vector> #include <cmath> #include <map> #include <set> #include <iomanip> #include <queue> #include <algorithm> #include <numeric> #include <deque> #include <complex> #include <cassert> using namespace std; using ll = long long; int main(){ const ll modc = 998244353; ll N, A, B; cin >> N >> A >> B; vector<ll> p(N+1); p[0] = 1; p[1] = 1; for (ll i=2; i<=N; i++){ p[i] = (p[i-1] * i) % modc; p[i] %= modc; } if (A != B){ cout << (p[N] + modc*2 - p[N-1]*2 + p[N-2]) % modc << endl; } else{ cout << (p[N] + modc*2 - p[N-1]*2) % modc << endl; } return 0; }