結果

問題 No.2600 Avator Height
ユーザー forest3forest3
提出日時 2024-01-13 15:53:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 395 ms / 2,000 ms
コード長 541 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 169,060 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-13 15:53:53
合計ジャッジ時間 13,812 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,676 KB
testcase_01 AC 345 ms
6,676 KB
testcase_02 AC 349 ms
6,676 KB
testcase_03 AC 366 ms
6,676 KB
testcase_04 AC 345 ms
6,676 KB
testcase_05 AC 354 ms
6,676 KB
testcase_06 AC 347 ms
6,676 KB
testcase_07 AC 351 ms
6,676 KB
testcase_08 AC 351 ms
6,676 KB
testcase_09 AC 349 ms
6,676 KB
testcase_10 AC 352 ms
6,676 KB
testcase_11 AC 351 ms
6,676 KB
testcase_12 AC 352 ms
6,676 KB
testcase_13 AC 368 ms
6,676 KB
testcase_14 AC 343 ms
6,676 KB
testcase_15 AC 395 ms
6,676 KB
testcase_16 AC 370 ms
6,676 KB
testcase_17 AC 351 ms
6,676 KB
testcase_18 AC 350 ms
6,676 KB
testcase_19 AC 356 ms
6,676 KB
testcase_20 AC 350 ms
6,676 KB
testcase_21 AC 359 ms
6,676 KB
testcase_22 AC 356 ms
6,676 KB
testcase_23 AC 357 ms
6,676 KB
testcase_24 AC 302 ms
6,676 KB
testcase_25 AC 346 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define rep(i, a, n) for(int i = a; i < n; i++)

int main() {
	int Q;
	cin >> Q;
	ll ma = 2e5, MOD = 998244353;
	vector<ll> r(ma), e(ma);
	r[0] = 1;
	r[1] = 1;
	e[0] = 1;
	e[1] = 3;
	rep(i, 2, ma) {
		r[i] = (r[i - 1] + r[i - 2]) % MOD;
		e[i] = (e[i - 1] + e[i - 2]) % MOD;
	}
	rep(i, 0, Q) {
		int n;
		cin >> n;
		n--;
		ll rx = r[n];
		ll ex = e[n];
		ll ans = rx * rx % MOD * 5 % MOD;
		ll s = ex * ex % MOD;
		ans = (ans - s + MOD) % MOD;
		cout << ans << endl;
	}
}
0