結果

問題 No.657 テトラナッチ数列 Easy
ユーザー m-44m-44
提出日時 2019-10-05 20:51:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 164,112 KB
実行使用メモリ 11,416 KB
最終ジャッジ日時 2024-04-16 09:51:45
合計ジャッジ時間 2,739 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
11,264 KB
testcase_01 AC 9 ms
11,332 KB
testcase_02 AC 9 ms
11,256 KB
testcase_03 AC 9 ms
11,264 KB
testcase_04 AC 9 ms
11,392 KB
testcase_05 AC 24 ms
11,360 KB
testcase_06 AC 9 ms
11,264 KB
testcase_07 AC 9 ms
11,264 KB
testcase_08 AC 9 ms
11,264 KB
testcase_09 AC 25 ms
11,264 KB
testcase_10 AC 25 ms
11,392 KB
testcase_11 AC 25 ms
11,392 KB
testcase_12 AC 25 ms
11,392 KB
testcase_13 AC 27 ms
11,380 KB
testcase_14 AC 27 ms
11,388 KB
testcase_15 AC 26 ms
11,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long t[1000001];

int main() {
  int q;
  cin>>q;
  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];
    t[i] %= 17;
  }
  for (int i=0; i<q; i++) {
    int n;
    cin>>n;
    cout<<t[n]<<endl;
  }

}
0