結果

問題 No.657 テトラナッチ数列 Easy
ユーザー Tokuzoo
提出日時 2021-05-07 23:31:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 68,096 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-09-15 11:36:54
合計ジャッジ時間 1,773 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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