結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 夕叢霧香(ゆうむらきりか)夕叢霧香(ゆうむらきりか)
提出日時 2018-03-02 22:23:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 804 ms
コンパイル使用メモリ 68,744 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-06-13 03:06:39
合計ジャッジ時間 2,027 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)

const int N=1001000;
int dp[N];

int main(){
  int q;
  cin>>q;
  dp[4]=1;
  for(int i=5;i<N;++i){
    rep(j,4)dp[i]+=dp[i-j-1];
    dp[i]%=17;
  }
  rep(_,q){
    int n;
    cin>>n;
    cout<<dp[n]<<endl;
  }
}
0