結果
| 問題 | 
                            No.2048 L(I+D)S
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-11-05 22:26:15 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 72 ms / 2,000 ms | 
| コード長 | 462 bytes | 
| コンパイル時間 | 3,310 ms | 
| コンパイル使用メモリ | 250,232 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-05 22:26:48 | 
| 合計ジャッジ時間 | 4,435 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 16 | 
ソースコード
#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;
int main(){
  int n;
  cin >> n;
  vector<mint> fact(n+1, 1);
  for(int i=0; i<n; i++){
    fact[i+1] = fact[i]*(i+1);
  }
  mint ans = 0;
  for(int a=2; a<=n-2; a++){
    int b = n-a;
    mint add = fact[n];
    add /= fact[b-2];
    add /= fact[a-2];
    add /= b;
    add /= a;
    add /= a+b-1;
    ans += add*add;
  }
  cout << ans.val() << endl;
}