結果

問題 No.657 テトラナッチ数列 Easy
コンテスト
ユーザー k
提出日時 2020-06-04 21:45:51
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 26 ms / 2,000 ms
+ 466µs
コード長 526 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,512 ms
コンパイル使用メモリ 208,568 KB
実行使用メモリ 9,860 KB
最終ジャッジ日時 2026-10-29 17:59:16
合計ジャッジ時間 3,123 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);

int t[1000000+1];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(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];
    t[i] %= 17;
  }

  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    cout << t[n] << endl;
  }
  
  return 0;
}
0