結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 0918nobita0918nobita
提出日時 2018-03-19 10:48:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 51,816 KB
実行使用メモリ 7,556 KB
最終ジャッジ日時 2023-08-30 03:34:07
合計ジャッジ時間 1,583 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
7,372 KB
testcase_01 AC 10 ms
7,308 KB
testcase_02 AC 10 ms
7,460 KB
testcase_03 AC 9 ms
7,284 KB
testcase_04 AC 9 ms
7,316 KB
testcase_05 AC 23 ms
7,436 KB
testcase_06 AC 9 ms
7,324 KB
testcase_07 AC 9 ms
7,268 KB
testcase_08 AC 9 ms
7,228 KB
testcase_09 AC 25 ms
7,268 KB
testcase_10 AC 25 ms
7,308 KB
testcase_11 AC 25 ms
7,316 KB
testcase_12 AC 26 ms
7,556 KB
testcase_13 AC 27 ms
7,352 KB
testcase_14 AC 26 ms
7,268 KB
testcase_15 AC 26 ms
7,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;

int main() {
    int T[1000001] = {0, 0, 0, 0, 1};
    
    rep(i, 5, 1000001) T[i] = (T[i - 1] + T[i - 2] + T[i - 3] + T[i - 4]) % 17;
    
    int Q; cin >> Q;
    
    rep(i, 0, Q) {
        int n; cin >> n;
        cout << T[n]<< endl;
    }
    
    return 0;
}
0