結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 4 ms
4,384 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 19 ms
4,380 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 20 ms
4,380 KB
testcase_10 AC 20 ms
4,376 KB
testcase_11 AC 20 ms
4,380 KB
testcase_12 AC 21 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

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;

    long n;

    long T[1000001];

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

    for (long j = 5; j < 100001; ++j) {

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

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

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

0