結果

問題 No.657 テトラナッチ数列 Easy
ユーザー SSRSSSRS
提出日時 2020-11-14 11:27:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 165,396 KB
実行使用メモリ 7,000 KB
最終ジャッジ日時 2023-09-30 04:48:52
合計ジャッジ時間 2,931 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,828 KB
testcase_01 AC 8 ms
6,952 KB
testcase_02 AC 8 ms
6,700 KB
testcase_03 AC 8 ms
6,940 KB
testcase_04 AC 8 ms
6,708 KB
testcase_05 AC 22 ms
6,816 KB
testcase_06 AC 8 ms
6,920 KB
testcase_07 AC 8 ms
6,704 KB
testcase_08 AC 8 ms
6,748 KB
testcase_09 AC 24 ms
6,904 KB
testcase_10 AC 24 ms
6,960 KB
testcase_11 AC 24 ms
6,964 KB
testcase_12 AC 25 ms
6,776 KB
testcase_13 AC 25 ms
6,960 KB
testcase_14 AC 25 ms
7,000 KB
testcase_15 AC 25 ms
6,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> T(1000000);
  T[0] = 0;
  T[1] = 0;
  T[2] = 0;
  T[3] = 1;
  for (int i = 4; i < 1000000; i++){
    T[i] = (T[i - 1] + T[i - 2] + T[i - 3] + T[i - 4]) % 17;
  }
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++){
    int n;
    cin >> n;
    cout << T[n - 1] << endl;
  }
}
0