結果

問題 No.657 テトラナッチ数列 Easy
ユーザー GBGB
提出日時 2019-02-14 14:40:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 426 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 64,328 KB
実行使用メモリ 7,072 KB
最終ジャッジ日時 2023-10-11 12:37:52
合計ジャッジ時間 2,159 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 WA -
testcase_07 AC 2 ms
4,352 KB
testcase_08 WA -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){

  int q=0;
  cin>>q;
  vector<int> queri(q,0);
  for(int i=0;i<q;i++)cin>>queri[i];
  int max=*max_element(queri.begin(),queri.end());

  vector<int> dp(max+1,0);
  dp[1]=dp[2]=dp[3]=0;
  dp[4]=1;
  for(int i=5;i<q;i++)dp[i]=dp[i-1]+dp[i-2]+dp[i-3]+dp[i-4];
  for(int i=0;i<queri.size();i++)cout<<dp[queri[i]]%17<<endl;

  return 0;
}
0