結果
問題 | No.2600 Avator Height |
ユーザー |
![]() |
提出日時 | 2024-01-15 11:09:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 49 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 2,135 ms |
コンパイル使用メモリ | 194,100 KB |
最終ジャッジ日時 | 2025-02-18 20:11:10 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using mint = atcoder::modint998244353; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } mint r[3 << 17], e[3 << 17]; int main() { fast_io(); r[1] = r[2] = e[1] = 1; e[2] = 3; for (int i = 3; i < (3 << 17); i++) { r[i] = r[i - 1] + r[i - 2]; e[i] = e[i - 1] + e[i - 2]; } int q; cin >> q; while (q--) { int n; cin >> n; mint ans = 5 * r[n].pow(2) - e[n].pow(2); cout << ans.val() << "\n"; } }