結果

問題 No.657 テトラナッチ数列 Easy
ユーザー J31831276J31831276
提出日時 2018-12-28 11:13:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 58,060 KB
実行使用メモリ 7,404 KB
最終ジャッジ日時 2024-04-09 03:10:37
合計ジャッジ時間 1,469 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
7,116 KB
testcase_01 AC 9 ms
7,200 KB
testcase_02 AC 9 ms
7,272 KB
testcase_03 AC 9 ms
7,348 KB
testcase_04 AC 9 ms
7,260 KB
testcase_05 AC 24 ms
7,184 KB
testcase_06 AC 9 ms
7,276 KB
testcase_07 AC 9 ms
7,356 KB
testcase_08 AC 9 ms
7,364 KB
testcase_09 AC 25 ms
7,308 KB
testcase_10 AC 25 ms
7,296 KB
testcase_11 AC 25 ms
7,404 KB
testcase_12 AC 26 ms
7,400 KB
testcase_13 AC 27 ms
7,152 KB
testcase_14 AC 26 ms
7,328 KB
testcase_15 AC 27 ms
7,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>

#define ll long long

using namespace std;

int T[1000001];

int main(){
  
  T[1]=T[2]=T[3]=0;
  T[4]=1;
  for(int i=5;i<=1000000;++i) T[i]=(T[i-1]+T[i-2]+T[i-3]+T[i-4])%17;
  
  int q;
  cin>>q;
  int p;
  for(int i=0;i<q;++i){
     cin>>p;
     cout<<T[p]<<endl;
  }

  return 0;
}
0