結果

問題 No.2600 Avator Height
ユーザー ococonomy1ococonomy1
提出日時 2024-01-12 21:24:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 1,862 bytes
コンパイル時間 1,015 ms
コンパイル使用メモリ 109,864 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-12 21:24:16
合計ジャッジ時間 4,885 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll,int>;
#define TEST cerr << "TEST" << endl
#define AMARI 998244353
// #define AMARI 1000000007
#define TIME_LIMIT 1980000
#define el '\n'
#define El '\n'

#define MULTI_TEST_CASE false
void solve(void) {
    //問題を見たらまず「この問題設定から言えること」をいっぱい言ってみる
    //一個解答に繋がりそうな解法が見えても、実装や細かい考察に時間がかかりそうなら別の方針やを考えてみる
    //特に添え字周りはそのままやると面倒&言い換えが有効なことが多いので書き始める前にじっくり考える
    const int m = 200001;
    vector<ll> r(m),e(m);
    r[0] = r[1] = 1;
    e[0] = 1; e[1] = 3;
    for(int i = 2; i < m; i++){
        r[i] = r[i - 1] + r[i - 2]; r[i] %= AMARI;
        e[i] = e[i - 1] + e[i - 2]; e[i] %= AMARI;
    }
    int q;
    cin >> q;
    while(q--){
        int n;
        cin >> n;
        n--;
        ll ans = r[n] * r[n]; ans %= AMARI;
        ans *= 5; ans %= AMARI;
        ans -= (e[n] * e[n]) % AMARI;
        if(ans < 0)ans += AMARI;
        ans %= AMARI;
        cout << ans << El;
    }
    return;
}

void calc(void) {
    return;
}

signed main(void) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    calc();
    int t = 1;
    if(MULTI_TEST_CASE) cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}
0