結果

問題 No.657 テトラナッチ数列 Easy
ユーザー kobaryo222kobaryo222
提出日時 2018-03-02 22:28:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,141 bytes
コンパイル時間 1,508 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 7,492 KB
最終ジャッジ日時 2023-09-03 22:54:37
合計ジャッジ時間 1,810 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int a[1000010];

int main(){
    int q;
    cin >> q;
    REP(i, 1000010){
        if(i < 3) a[i] = 0;
        else if(i == 3) a[i] = 1;
        else a[i] = (a[i - 1] + a[i - 2] + a[i - 3] + a[i - 4]) % 17;
    }
    REP(i, q){
        int tmp;
        cin >> tmp;
        cout << a[tmp] << endl;
    }
    return 0;
}
0