結果

問題 No.2600 Avator Height
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-01-15 11:09:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 579 bytes
コンパイル時間 2,453 ms
コンパイル使用メモリ 203,608 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-15 11:09:45
合計ジャッジ時間 6,715 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,676 KB
testcase_01 AC 44 ms
6,676 KB
testcase_02 AC 44 ms
6,676 KB
testcase_03 AC 42 ms
6,676 KB
testcase_04 AC 43 ms
6,676 KB
testcase_05 AC 42 ms
6,676 KB
testcase_06 AC 42 ms
6,676 KB
testcase_07 AC 43 ms
6,676 KB
testcase_08 AC 41 ms
6,676 KB
testcase_09 AC 42 ms
6,676 KB
testcase_10 AC 41 ms
6,676 KB
testcase_11 AC 42 ms
6,676 KB
testcase_12 AC 42 ms
6,676 KB
testcase_13 AC 41 ms
6,676 KB
testcase_14 AC 42 ms
6,676 KB
testcase_15 AC 42 ms
6,676 KB
testcase_16 AC 41 ms
6,676 KB
testcase_17 AC 41 ms
6,676 KB
testcase_18 AC 54 ms
6,676 KB
testcase_19 AC 41 ms
6,676 KB
testcase_20 AC 41 ms
6,676 KB
testcase_21 AC 41 ms
6,676 KB
testcase_22 AC 42 ms
6,676 KB
testcase_23 AC 42 ms
6,676 KB
testcase_24 AC 28 ms
6,676 KB
testcase_25 AC 38 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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";
    }
}
0