結果
問題 |
No.3172 三角関数べき乗のフーリエ級数展開
|
ユーザー |
![]() |
提出日時 | 2025-06-08 21:55:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 846 bytes |
コンパイル時間 | 1,920 ms |
コンパイル使用メモリ | 195,644 KB |
実行使用メモリ | 8,648 KB |
最終ジャッジ日時 | 2025-06-08 21:55:57 |
合計ジャッジ時間 | 3,937 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } #include <atcoder/modint> using mint = atcoder::modint998244353; mint fact[500000], inv_fact[500000]; void init() { fact[0] = 1; for (int i = 1; i < 500000; ++i) { fact[i] = fact[i - 1] * i; } inv_fact[499999] = fact[499999].inv(); for (int i = 499998; i >= 0; --i) { inv_fact[i] = inv_fact[i + 1] * (i + 1); } } mint binom(int n, int k) { if (n < 0 || k < 0 || k > n) return 0; return fact[n] * inv_fact[k] * inv_fact[n - k]; } int main() { fast_io(); init(); int n; cin >> n; vector<mint> a(2 * n + 1); for (int i = 0; i <= 2 * n; i += 2) { a[i] = binom(n, i / 2); } for (int i = 0; i <= n; i++) { mint ans = (i == 0 ? a[n] : a[n + i] + a[n - i]); cout << ans.val() << (i == n ? "\n" : " "); } }