結果

問題 No.658 テトラナッチ数列 Hard
ユーザー lunnearlunnear
提出日時 2018-12-12 14:27:27
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 795 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 61,536 KB
実行使用メモリ 813,680 KB
最終ジャッジ日時 2023-10-25 08:25:07
合計ジャッジ時間 3,613 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 MLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

int main()
{
    int q;
    std::cin >> q;
    
    std::vector<int> list;
    int t1 = 0, t2 = 0, t3 = 0, t4 = 1;
    list.push_back(0);
    list.push_back(0);
    list.push_back(0);
    list.push_back(1);
    
    
    for(int i = 0; i < q; i++)
    {
        long long n;
        std::cin >> n;
        
        if(n > list.size())
        {
            for(long long j = list.size(); j < n; j++)
            {
                int t = t1 + t2 + t3 + t4;
                t %= 17;
                
                list.push_back(t);
                
                t1 = t2;
                t2 = t3;
                t3 = t4;
                t4 = t;
            }
        }
        
        std::cout << list[n - 1] << std::endl;
    }
    
    return 0;
}
0