結果

問題 No.2600 Avator Height
ユーザー umezoumezo
提出日時 2024-01-12 23:48:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 2,115 ms
コンパイル使用メモリ 201,264 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-12 23:48:27
合計ジャッジ時間 5,980 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;

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

const int MOD=998244353;
ll r[200200],e[200200];

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  r[1]=1,r[2]=1,e[1]=1,e[2]=3;
  for(int i=3;i<=200000;i++){
    r[i]=(r[i-1]+r[i-2])%MOD;
    e[i]=(e[i-1]+e[i-2])%MOD;
  }

  int q;
  cin>>q;
  while(q--){
    int n;
    cin>>n;
    if(n==1) cout<<4<<'\n';
    else if(n==2) cout<<MOD-4<<'\n';
    else{
      cout<<(5*r[n]%MOD*r[n]%MOD-e[n]*e[n]%MOD+MOD)%MOD<<'\n';
    }
  }
  
  return 0;
}
0