結果

問題 No.657 テトラナッチ数列 Easy
ユーザー vrjfsyivrjfsyi
提出日時 2018-04-01 15:56:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 67,304 KB
実行使用メモリ 7,472 KB
最終ジャッジ日時 2023-09-08 12:14:44
合計ジャッジ時間 1,713 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,472 KB
testcase_01 AC 14 ms
7,316 KB
testcase_02 AC 13 ms
7,344 KB
testcase_03 AC 14 ms
7,316 KB
testcase_04 AC 14 ms
7,168 KB
testcase_05 AC 30 ms
7,164 KB
testcase_06 AC 14 ms
7,244 KB
testcase_07 AC 14 ms
7,288 KB
testcase_08 AC 14 ms
7,372 KB
testcase_09 AC 30 ms
7,304 KB
testcase_10 AC 30 ms
7,432 KB
testcase_11 AC 30 ms
7,156 KB
testcase_12 AC 31 ms
7,244 KB
testcase_13 AC 31 ms
7,372 KB
testcase_14 AC 32 ms
7,252 KB
testcase_15 AC 31 ms
7,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <array>
#include <map>
#include <stack>
#include <queue>
#include <set>

using namespace std;


int main() {


    int Q;
    cin >> Q;

    int n;

    int T[1000001] = {0};

    T[1] = 0;
    T[2] = 0;
    T[3] = 0;
    T[4] = 1;

    for (int j = 5; j < 1000001; ++j) {

        for (int i = 1; i < 5; ++i) {
            T[j] += T[j - i] % 17;
        }
        T[j] = T[j] % 17;
    }

    for (int i = 0; i < Q; ++i) {
        cin >> n;

        cout << T[n] << "\n";
    }

    return 0;
}

0