結果

問題 No.657 テトラナッチ数列 Easy
ユーザー dustnn0dustnn0
提出日時 2018-03-09 19:48:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 162,876 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-17 22:53:25
合計ジャッジ時間 2,348 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
11,248 KB
testcase_01 AC 8 ms
11,392 KB
testcase_02 AC 8 ms
11,264 KB
testcase_03 AC 8 ms
11,392 KB
testcase_04 AC 8 ms
11,244 KB
testcase_05 AC 23 ms
11,136 KB
testcase_06 AC 9 ms
11,392 KB
testcase_07 AC 8 ms
11,384 KB
testcase_08 AC 9 ms
11,340 KB
testcase_09 AC 23 ms
11,316 KB
testcase_10 AC 23 ms
11,392 KB
testcase_11 AC 23 ms
11,392 KB
testcase_12 AC 24 ms
11,264 KB
testcase_13 AC 25 ms
11,392 KB
testcase_14 AC 26 ms
11,392 KB
testcase_15 AC 24 ms
11,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

const int NMAX=1000001;
ll T[NMAX];

int main(){
  T[4]=1;
  rep(i,NMAX-5){
    (T[i+5]=T[i+4]+T[i+3]+T[i+2]+T[i+1])%=17;
  }
  int Q;
  cin>>Q;
  rep(i,Q){
    int n;
    cin>>n;
    cout<<T[n]<<endl;
  }
  return 0;
}
0