結果

問題 No.657 テトラナッチ数列 Easy
ユーザー TokuzooTokuzoo
提出日時 2021-05-07 23:31:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 67,776 KB
実行使用メモリ 10,748 KB
最終ジャッジ日時 2023-10-13 14:51:27
合計ジャッジ時間 1,985 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
10,520 KB
testcase_01 AC 7 ms
10,604 KB
testcase_02 AC 8 ms
10,544 KB
testcase_03 AC 9 ms
10,528 KB
testcase_04 AC 8 ms
10,572 KB
testcase_05 AC 20 ms
10,496 KB
testcase_06 AC 9 ms
10,596 KB
testcase_07 AC 7 ms
10,624 KB
testcase_08 AC 8 ms
10,664 KB
testcase_09 AC 21 ms
10,736 KB
testcase_10 AC 23 ms
10,620 KB
testcase_11 AC 22 ms
10,700 KB
testcase_12 AC 23 ms
10,496 KB
testcase_13 AC 23 ms
10,748 KB
testcase_14 AC 23 ms
10,732 KB
testcase_15 AC 23 ms
10,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
using ll = long long;


int main(){
    vector<ll> t(1000000);

    t[0] = 0; t[1] = 0; t[2] = 0; t[3] = 1;

    for(int i=4; i<1000000; i++) t[i] = (t[i-1] + t[i-2] + t[i-3] + t[i-4]) % 17;

    int q;
    cin >> q;
    int n;

    while(q--){
        cin >> n;
        cout << t[n-1] << endl; 
    }
}
0