結果

問題 No.657 テトラナッチ数列 Easy
ユーザー hitoyozake
提出日時 2018-04-14 16:22:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,230 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 1,106 ms
コンパイル使用メモリ 83,788 KB
実行使用メモリ 66,048 KB
最終ジャッジ日時 2024-06-26 22:20:32
合計ジャッジ時間 22,555 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
#include <vector>



int main()
{
    int num = 0;
    std::map<int, long long int> map;
    std::cin >> num;
    std::vector<int> v;
    map[0]=0;map[1]=0;map[2]=0;map[3]=0;map[4]=1;
    
    for(int i = 5; i <= 1000000; ++i)
    {
        map[i] = (map[i-1]+map[i-2]+map[i-3]+map[i-4])%17;
    }
    
    for( int i = 0; i < num; ++i)
    {
        int x = 0;
        std::cin >> x;
        v.push_back(map[x]);
    }

    for( auto i: v)
    {
        std::cout << i%17 << std::endl;
    }

    return 0;
}
0