結果

問題 No.657 テトラナッチ数列 Easy
ユーザー CleyLCleyL
提出日時 2020-02-11 23:10:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 70,552 KB
実行使用メモリ 7,880 KB
最終ジャッジ日時 2024-04-08 17:12:42
合計ジャッジ時間 1,974 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
7,880 KB
testcase_01 AC 22 ms
7,880 KB
testcase_02 AC 24 ms
7,880 KB
testcase_03 AC 23 ms
7,880 KB
testcase_04 AC 22 ms
7,880 KB
testcase_05 AC 38 ms
7,880 KB
testcase_06 AC 23 ms
7,880 KB
testcase_07 AC 23 ms
7,880 KB
testcase_08 AC 23 ms
7,880 KB
testcase_09 AC 39 ms
7,880 KB
testcase_10 AC 39 ms
7,880 KB
testcase_11 AC 39 ms
7,880 KB
testcase_12 AC 40 ms
7,880 KB
testcase_13 AC 40 ms
7,880 KB
testcase_14 AC 40 ms
7,880 KB
testcase_15 AC 40 ms
7,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
    vector<int> dta;
    for(int i = 0; 3 > i; i++){
        dta.push_back(0);
    }
    dta.push_back(1);
    for(int i = 0; 1000000 > i; i++){
        
        int t = 0;
        for(int j = 1; 4 >= j; j++){
            t = (t+dta[dta.size()-j])%17;
        }
        dta.push_back(t);
    }
    int q;cin>>q;
    while(q--){
        int z;cin>>z;
        cout << dta[--z] << endl;
    }
}
0