結果

問題 No.657 テトラナッチ数列 Easy
ユーザー utouto97utouto97
提出日時 2019-01-21 23:05:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 777 bytes
コンパイル時間 3,240 ms
コンパイル使用メモリ 144,548 KB
実行使用メモリ 7,008 KB
最終ジャッジ日時 2023-10-13 17:29:06
合計ジャッジ時間 2,196 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,896 KB
testcase_01 AC 7 ms
6,708 KB
testcase_02 AC 9 ms
7,008 KB
testcase_03 AC 9 ms
6,844 KB
testcase_04 AC 8 ms
6,960 KB
testcase_05 AC 21 ms
6,848 KB
testcase_06 AC 8 ms
6,720 KB
testcase_07 AC 8 ms
6,900 KB
testcase_08 AC 8 ms
6,696 KB
testcase_09 AC 22 ms
6,828 KB
testcase_10 AC 21 ms
6,828 KB
testcase_11 AC 21 ms
6,748 KB
testcase_12 AC 22 ms
6,848 KB
testcase_13 AC 23 ms
6,760 KB
testcase_14 AC 22 ms
6,716 KB
testcase_15 AC 22 ms
6,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

int main()
{
  vi t(1000001);
  t[0] = t[1] = t[2] = 0;
  t[3] = 1;

  repi(i, 4, 1000001){
    t[i] = (t[i-1]+t[i-2]+t[i-3]+t[i-4])%17;
  }

  int q;
  cin >> q;
  rep(i, q){
    int n;
    cin >> n;
    cout << t[n-1] << endl;
  }

  return 0;
}
0