結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-03-08 20:06:37
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 522 bytes
コンパイル時間 1,173 ms
コンパイル使用メモリ 62,548 KB
実行使用メモリ 7,180 KB
最終ジャッジ日時 2023-09-05 19:42:10
合計ジャッジ時間 2,071 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 9 ms
6,616 KB
testcase_05 RE -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 10 ms
7,000 KB
testcase_09 AC 17 ms
4,380 KB
testcase_10 AC 17 ms
4,380 KB
testcase_11 AC 16 ms
4,376 KB
testcase_12 AC 18 ms
4,380 KB
testcase_13 AC 25 ms
7,064 KB
testcase_14 AC 26 ms
7,060 KB
testcase_15 AC 26 ms
7,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int Q,m=-1;
    cin >> Q;
    vector<int> A(Q);
    for(int i = 0; i < Q; i++) {
        cin >> A[i];
        A[i]--;
        m = max(m,A[i]);
    }
    vector<int> T(m);
    T[0] = T[1] = T[2] = 0;
    T[3] = 1;
    for(int i = 0; i < m - 3; i++) {
        T[i + 4] = T[i + 3] + T[i + 2] + T[i + 1] + T[i];
        T[i + 4] %= 17;
    }
    for(int i = 0; i < Q; i++) {
        cout << T[A[i]] << endl;
    }
    return 0;
}
0