結果
問題 | No.2048 L(I+D)S |
ユーザー |
![]() |
提出日時 | 2024-11-03 13:58:49 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 665 bytes |
コンパイル時間 | 3,205 ms |
コンパイル使用メモリ | 248,188 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-03 13:58:53 |
合計ジャッジ時間 | 4,397 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/modint> using mint = atcoder::modint998244353; #define rep(i, l, r) for (int i = (int)(l); i<(int)(r); i++) #define ll long long int main() { int N; cin >> N; if (N < 4) { cout << 0 << endl; return 0; } vector<mint> fac(N+1); fac[0] = 1; rep(i, 1, N+1) fac[i] = fac[i-1]*i; mint ans = 0; rep(h, 2, N-1) { int w = N-h; mint inv = fac[h-2]; inv *= fac[w-2]; inv *= h; inv *= w; inv *= (h+w-1); mint plus = fac[N]; plus/=inv; ans += plus*plus; } cout << ans.val() << endl; }