結果

問題 No.657 テトラナッチ数列 Easy
ユーザー dnishdnish
提出日時 2018-06-15 09:59:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 1,518 ms
コンパイル使用メモリ 166,476 KB
実行使用メモリ 7,048 KB
最終ジャッジ日時 2023-09-13 04:31:12
合計ジャッジ時間 3,547 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
6,892 KB
testcase_01 AC 20 ms
6,880 KB
testcase_02 AC 20 ms
6,932 KB
testcase_03 AC 20 ms
6,888 KB
testcase_04 AC 20 ms
6,916 KB
testcase_05 AC 35 ms
6,928 KB
testcase_06 AC 20 ms
6,952 KB
testcase_07 AC 20 ms
6,888 KB
testcase_08 AC 20 ms
6,992 KB
testcase_09 AC 35 ms
6,848 KB
testcase_10 AC 36 ms
6,888 KB
testcase_11 AC 36 ms
6,880 KB
testcase_12 AC 36 ms
7,048 KB
testcase_13 AC 37 ms
6,980 KB
testcase_14 AC 37 ms
6,988 KB
testcase_15 AC 36 ms
6,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) (a)<=(n)&&(n)<(b)
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
const ll inf =1e18;

int Q;
int main(){
    while(cin>>Q){
        vector<int> T(1000010,0);
        T[4]=1;
        REP(i,5,1000002){
            REP(j,1,5){
                T[i] += T[i-j];
                T[i]%=17;
            }
        }
        REP(i,0,Q){
            int n;
            cin>>n;
            p(T[n]);
        }
    }

}
0