結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 夕叢霧香(ゆうむらきりか)夕叢霧香(ゆうむらきりか)
提出日時 2018-03-02 22:23:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 2,270 ms
コンパイル使用メモリ 69,088 KB
実行使用メモリ 7,400 KB
最終ジャッジ日時 2023-09-03 22:29:23
合計ジャッジ時間 1,965 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,208 KB
testcase_01 AC 13 ms
7,400 KB
testcase_02 AC 13 ms
7,256 KB
testcase_03 AC 13 ms
7,212 KB
testcase_04 AC 13 ms
7,252 KB
testcase_05 AC 27 ms
7,236 KB
testcase_06 AC 13 ms
7,268 KB
testcase_07 AC 13 ms
7,312 KB
testcase_08 AC 13 ms
7,312 KB
testcase_09 AC 29 ms
7,256 KB
testcase_10 AC 29 ms
7,252 KB
testcase_11 AC 29 ms
7,248 KB
testcase_12 AC 29 ms
7,260 KB
testcase_13 AC 30 ms
7,236 KB
testcase_14 AC 30 ms
7,400 KB
testcase_15 AC 31 ms
7,312 KB
権限があれば一括ダウンロードができます

ソースコード

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