結果

問題 No.657 テトラナッチ数列 Easy
ユーザー eve__fuyukieve__fuyuki
提出日時 2018-03-17 19:29:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 51,460 KB
実行使用メモリ 7,592 KB
最終ジャッジ日時 2023-08-25 15:42:54
合計ジャッジ時間 1,931 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
7,304 KB
testcase_01 AC 9 ms
7,256 KB
testcase_02 AC 9 ms
7,268 KB
testcase_03 AC 9 ms
7,264 KB
testcase_04 AC 9 ms
7,304 KB
testcase_05 AC 21 ms
7,392 KB
testcase_06 AC 9 ms
7,316 KB
testcase_07 AC 8 ms
7,316 KB
testcase_08 AC 9 ms
7,276 KB
testcase_09 AC 22 ms
7,268 KB
testcase_10 AC 22 ms
7,380 KB
testcase_11 AC 23 ms
7,316 KB
testcase_12 AC 23 ms
7,264 KB
testcase_13 AC 23 ms
7,264 KB
testcase_14 AC 24 ms
7,592 KB
testcase_15 AC 23 ms
7,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int T[1000001]={0,0,0,0,1};

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