結果

問題 No.657 テトラナッチ数列 Easy
ユーザー kobaryo222kobaryo222
提出日時 2018-03-02 22:30:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,145 bytes
コンパイル時間 843 ms
コンパイル使用メモリ 82,280 KB
実行使用メモリ 7,484 KB
最終ジャッジ日時 2023-09-03 23:05:55
合計ジャッジ時間 2,096 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
7,184 KB
testcase_01 AC 9 ms
7,168 KB
testcase_02 AC 10 ms
7,484 KB
testcase_03 AC 10 ms
7,228 KB
testcase_04 AC 10 ms
7,172 KB
testcase_05 AC 25 ms
7,336 KB
testcase_06 AC 10 ms
7,224 KB
testcase_07 AC 10 ms
7,180 KB
testcase_08 AC 10 ms
7,212 KB
testcase_09 AC 25 ms
7,228 KB
testcase_10 AC 26 ms
7,188 KB
testcase_11 AC 26 ms
7,296 KB
testcase_12 AC 26 ms
7,380 KB
testcase_13 AC 27 ms
7,296 KB
testcase_14 AC 27 ms
7,180 KB
testcase_15 AC 27 ms
7,292 KB
権限があれば一括ダウンロードができます

ソースコード

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 - 1] << endl;
    }
    return 0;
}
0