結果

問題 No.657 テトラナッチ数列 Easy
ユーザー shikakushikaku
提出日時 2018-04-25 08:28:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 59,664 KB
実行使用メモリ 6,984 KB
最終ジャッジ日時 2023-09-10 05:22:15
合計ジャッジ時間 1,520 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,716 KB
testcase_01 AC 3 ms
6,696 KB
testcase_02 AC 4 ms
6,684 KB
testcase_03 AC 4 ms
6,872 KB
testcase_04 AC 8 ms
6,704 KB
testcase_05 AC 18 ms
6,744 KB
testcase_06 AC 4 ms
6,676 KB
testcase_07 AC 4 ms
6,692 KB
testcase_08 AC 8 ms
6,872 KB
testcase_09 AC 19 ms
6,816 KB
testcase_10 AC 20 ms
6,916 KB
testcase_11 AC 20 ms
6,968 KB
testcase_12 AC 20 ms
6,984 KB
testcase_13 AC 26 ms
6,812 KB
testcase_14 AC 25 ms
6,836 KB
testcase_15 AC 25 ms
6,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


    int q, i;

    int m = 0;

    vector<int> t(1000000);

    t.at(1) = 0;

    t.at(2) = 0;

    t.at(3) = 0;

    t.at(4) = 1;

    
    cin >> q;

    vector<int> n(q);


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

        cin >> n.at(i);

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

        }


    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