結果

問題 No.657 テトラナッチ数列 Easy
ユーザー hitoyozakehitoyozake
提出日時 2018-04-14 16:22:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,224 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 953 ms
コンパイル使用メモリ 83,308 KB
実行使用メモリ 66,216 KB
最終ジャッジ日時 2023-09-09 05:15:07
合計ジャッジ時間 22,434 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,187 ms
65,868 KB
testcase_01 AC 1,190 ms
65,932 KB
testcase_02 AC 1,188 ms
65,812 KB
testcase_03 AC 1,187 ms
65,976 KB
testcase_04 AC 1,190 ms
66,012 KB
testcase_05 AC 1,207 ms
65,916 KB
testcase_06 AC 1,190 ms
65,928 KB
testcase_07 AC 1,194 ms
65,828 KB
testcase_08 AC 1,191 ms
65,868 KB
testcase_09 AC 1,204 ms
66,112 KB
testcase_10 AC 1,212 ms
66,040 KB
testcase_11 AC 1,211 ms
65,932 KB
testcase_12 AC 1,215 ms
65,948 KB
testcase_13 AC 1,224 ms
65,972 KB
testcase_14 AC 1,221 ms
65,972 KB
testcase_15 AC 1,222 ms
66,216 KB
権限があれば一括ダウンロードができます

ソースコード

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