結果

問題 No.658 テトラナッチ数列 Hard
ユーザー shikakushikaku
提出日時 2018-04-25 09:02:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 1,179 ms
コンパイル使用メモリ 59,952 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 05:23:43
合計ジャッジ時間 1,985 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
                                                                                                
  
int main(){


    long long q, i, s;

    long long m = 0;

    
    cin >> q;

    vector<long long> n(q);


    for( i = 0 ; i < q ; i = i + 1 ){

        cin >> s;

        n.at(i) = s % 4912;

        if( n.at(i) > m ) m = n.at(i);

        }


    vector<long long> t(m + 1);

    t.at(1) = 0;

    t.at(2) = 0;

    t.at(3) = 0;

    t.at(4) = 1;


    for( i = 5 ; i <= m ; i = i + 1 ){

         t.at(i) = ( t.at(i - 1) + t.at(i - 2) + t.at(i - 3) + t.at(i - 4) ) % 17;

         }

                                            
    for( i = 0 ; i < q ; i = i + 1 ){

        cout << t.at( n.at(i) ) << endl;

        }


    return 0;

}
0