結果

問題 No.657 テトラナッチ数列 Easy
ユーザー tecchaxntecchaxn
提出日時 2018-03-02 23:00:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 1,076 ms
コンパイル使用メモリ 143,888 KB
実行使用メモリ 11,356 KB
最終ジャッジ日時 2023-09-04 06:09:18
合計ジャッジ時間 2,159 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
11,352 KB
testcase_01 AC 11 ms
11,356 KB
testcase_02 AC 11 ms
11,160 KB
testcase_03 AC 11 ms
11,168 KB
testcase_04 AC 10 ms
11,224 KB
testcase_05 AC 24 ms
11,164 KB
testcase_06 AC 11 ms
11,160 KB
testcase_07 AC 11 ms
11,232 KB
testcase_08 AC 10 ms
11,216 KB
testcase_09 AC 26 ms
11,356 KB
testcase_10 AC 26 ms
11,292 KB
testcase_11 AC 27 ms
11,224 KB
testcase_12 AC 27 ms
11,212 KB
testcase_13 AC 28 ms
11,224 KB
testcase_14 AC 28 ms
11,284 KB
testcase_15 AC 28 ms
11,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
#define INF 1e18
using namespace std;

//-----------------------------------------------------------------------

const int mod=17;

int t[1000005];

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