結果

問題 No.657 テトラナッチ数列 Easy
ユーザー aka_riceaka_rice
提出日時 2018-03-03 11:05:50
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 828 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 164,600 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-06 00:37:53
合計ジャッジ時間 4,667 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define pout(n)  printf ("%d\n", n)
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)
const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
#define MAX_N (int)2e5+20
typedef long long ll;
using namespace std;

int q;
int main(){
    scanf("%d",&q);
    int t[q];
    t[0] = 0;
    t[1] = 0;
    t[2] = 0;
    t[3] = 1;
    rep(i,4,1000000){
        t[i] = (t[i-1]+t[i-2]+t[i-3]+t[i-4])%17;
    }
    int a[q];
    rep(i,0,q){
        cin >> a[i];
        printf("%d\n",t[a[i]-1]);        
    }
}
0