結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 0x19f0x19f
提出日時 2018-03-02 22:27:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 1,391 ms
コンパイル使用メモリ 166,448 KB
実行使用メモリ 11,268 KB
最終ジャッジ日時 2023-09-03 22:51:38
合計ジャッジ時間 2,402 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
10,884 KB
testcase_01 AC 9 ms
10,868 KB
testcase_02 AC 9 ms
10,744 KB
testcase_03 AC 9 ms
10,704 KB
testcase_04 AC 9 ms
10,748 KB
testcase_05 AC 23 ms
11,268 KB
testcase_06 AC 9 ms
10,824 KB
testcase_07 AC 9 ms
11,052 KB
testcase_08 AC 8 ms
10,748 KB
testcase_09 AC 24 ms
11,012 KB
testcase_10 AC 25 ms
10,772 KB
testcase_11 AC 24 ms
11,120 KB
testcase_12 AC 25 ms
10,884 KB
testcase_13 AC 25 ms
11,148 KB
testcase_14 AC 25 ms
11,012 KB
testcase_15 AC 25 ms
11,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  ll Q;
  cin >> Q;
  vector<ll> N(Q);
  REP(i, 0, Q) cin >> N[i];

  vector<ll> x(1000001);
  x[1] = x[2] = x[3] = 0;
  x[4] = 1;
  REP(i, 5, 1000000) x[i] = (x[i - 1] + x[i - 2] + x[i - 3] + x[i - 4]) % 17;

  REP(i, 0, Q) cout << x[N[i]] << endl;
}
0