結果

問題 No.657 テトラナッチ数列 Easy
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-20 00:34:07
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 2,204 ms
コンパイル使用メモリ 193,520 KB
実行使用メモリ 7,648 KB
最終ジャッジ日時 2024-04-15 15:08:20
合計ジャッジ時間 3,207 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
7,336 KB
testcase_01 AC 7 ms
7,416 KB
testcase_02 AC 8 ms
7,508 KB
testcase_03 AC 8 ms
7,336 KB
testcase_04 AC 7 ms
7,384 KB
testcase_05 AC 22 ms
7,464 KB
testcase_06 AC 7 ms
7,460 KB
testcase_07 AC 8 ms
7,552 KB
testcase_08 AC 8 ms
7,308 KB
testcase_09 AC 23 ms
7,544 KB
testcase_10 AC 24 ms
7,424 KB
testcase_11 AC 23 ms
7,424 KB
testcase_12 AC 24 ms
7,496 KB
testcase_13 AC 26 ms
7,380 KB
testcase_14 AC 25 ms
7,552 KB
testcase_15 AC 26 ms
7,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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