結果

問題 No.657 テトラナッチ数列 Easy
ユーザー aaaaaaiu
提出日時 2019-08-20 00:34:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 1,838 ms
コンパイル使用メモリ 191,900 KB
最終ジャッジ日時 2025-01-07 14:18:55
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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