結果

問題 No.657 テトラナッチ数列 Easy
ユーザー gotutiyangotutiyan
提出日時 2018-03-02 23:42:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 924 bytes
コンパイル時間 2,277 ms
コンパイル使用メモリ 81,228 KB
実行使用メモリ 7,376 KB
最終ジャッジ日時 2023-09-04 15:32:15
合計ジャッジ時間 1,735 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
7,200 KB
testcase_01 AC 8 ms
7,168 KB
testcase_02 AC 8 ms
7,352 KB
testcase_03 AC 8 ms
7,232 KB
testcase_04 AC 8 ms
7,376 KB
testcase_05 AC 22 ms
7,288 KB
testcase_06 AC 8 ms
7,272 KB
testcase_07 AC 8 ms
7,192 KB
testcase_08 AC 8 ms
7,192 KB
testcase_09 AC 23 ms
7,244 KB
testcase_10 AC 23 ms
7,196 KB
testcase_11 AC 24 ms
7,200 KB
testcase_12 AC 24 ms
7,216 KB
testcase_13 AC 24 ms
7,196 KB
testcase_14 AC 25 ms
7,188 KB
testcase_15 AC 25 ms
7,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main(){
    int v[1000010];
    v[0]=0;
    v[1]=0;
    v[2]=0;
    v[3]=1;
    rep(i,4,1000001){
        v[i]=v[i-1]+v[i-2]+v[i-3]+v[i-4];
        v[i]%=17;
    }
    
    int n;
    cin>>n;
    rep(i,0,n){
        int x; cin>>x;
        cout<<v[x-1]<<endl;
    }
    return 0;
}
0