結果

問題 No.2600 Avator Height
ユーザー tobbietobbie
提出日時 2024-05-06 11:54:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 343 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 1,575 ms
コンパイル使用メモリ 167,836 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-28 18:19:08
合計ジャッジ時間 12,622 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 333 ms
6,816 KB
testcase_02 AC 325 ms
6,816 KB
testcase_03 AC 339 ms
6,816 KB
testcase_04 AC 332 ms
6,820 KB
testcase_05 AC 337 ms
6,820 KB
testcase_06 AC 330 ms
6,820 KB
testcase_07 AC 343 ms
6,820 KB
testcase_08 AC 341 ms
6,820 KB
testcase_09 AC 342 ms
6,820 KB
testcase_10 AC 334 ms
6,816 KB
testcase_11 AC 337 ms
6,816 KB
testcase_12 AC 335 ms
6,820 KB
testcase_13 AC 343 ms
6,816 KB
testcase_14 AC 340 ms
6,820 KB
testcase_15 AC 343 ms
6,816 KB
testcase_16 AC 337 ms
6,820 KB
testcase_17 AC 338 ms
6,820 KB
testcase_18 AC 340 ms
6,816 KB
testcase_19 AC 334 ms
6,816 KB
testcase_20 AC 332 ms
6,820 KB
testcase_21 AC 341 ms
6,820 KB
testcase_22 AC 337 ms
6,816 KB
testcase_23 AC 331 ms
6,816 KB
testcase_24 AC 291 ms
6,816 KB
testcase_25 AC 318 ms
6,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

int main() {
  int ni = 2e5;
  vector<int> R(ni, 1);
  vector<int> E(ni, 1); E[1] = 3;
  rep(i, ni-2) {
    R[i+2] = (R[i] + R[i+1]) % MOD;
    E[i+2] = (E[i] + E[i+1]) % MOD;
  }
  int Q;
  cin >> Q;
  rep(i, Q) {
    int Ni;
    cin >> Ni;
    int ans = ((ll)R[Ni-1] * (ll)R[Ni-1] * 5) % MOD;
    ans -= ((ll)E[Ni-1] * (ll)E[Ni-1]) % MOD;
    if (ans < 0) ans += MOD;
    cout << ans << endl;
  }
  return 0;
}
0