結果

問題 No.657 テトラナッチ数列 Easy
ユーザー どららどらら
提出日時 2018-03-02 22:25:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 2,856 ms
コンパイル使用メモリ 162,444 KB
実行使用メモリ 7,448 KB
最終ジャッジ日時 2023-09-03 22:40:22
合計ジャッジ時間 2,382 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
7,308 KB
testcase_01 AC 8 ms
7,448 KB
testcase_02 AC 8 ms
7,244 KB
testcase_03 AC 8 ms
7,292 KB
testcase_04 AC 8 ms
7,248 KB
testcase_05 AC 23 ms
7,428 KB
testcase_06 AC 9 ms
7,232 KB
testcase_07 AC 8 ms
7,248 KB
testcase_08 AC 8 ms
7,312 KB
testcase_09 AC 24 ms
7,380 KB
testcase_10 AC 24 ms
7,240 KB
testcase_11 AC 24 ms
7,244 KB
testcase_12 AC 25 ms
7,328 KB
testcase_13 AC 25 ms
7,308 KB
testcase_14 AC 25 ms
7,248 KB
testcase_15 AC 25 ms
7,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int T[1000005];

int main(){
  T[4] = 1;
  REP(i,5,1000005){
    T[i] = T[i-1] + T[i-2] + T[i-3] + T[i-4];
    T[i] %= 17;
  }

  int Q;
  cin >> Q;
  rep(i,Q){
    int n;
    cin >> n;
    cout << T[n] << endl;
  }
  
  return 0;
}

0