結果

問題 No.658 テトラナッチ数列 Hard
ユーザー amtgjwamtgjw
提出日時 2018-06-06 09:52:06
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 1,905 ms
コンパイル使用メモリ 64,712 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 22:41:22
合計ジャッジ時間 1,470 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 18 ms
4,380 KB
testcase_05 AC 18 ms
4,380 KB
testcase_06 AC 19 ms
4,380 KB
testcase_07 AC 19 ms
4,376 KB
testcase_08 AC 19 ms
4,380 KB
testcase_09 AC 21 ms
4,380 KB
testcase_10 AC 21 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define REP(i,n)	for(int i=0;i<(n);++i)
#define REPS(i,s,t)	for(int i=(s);i<(t);++i)

#define INF 		2000000007
#define MINF		-200000007
#define MOD			17 	
// 2^20

#define MAX 		100005

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

int dp[4912];

int main(){
	int N;cin>>N;

	dp[0]=dp[1]=dp[2]=0;
	dp[3]=1;
	REPS(i,4,4912)
		dp[i] = (dp[i-4]+dp[i-3]+dp[i-2]+dp[i-1])%MOD;

	REP(i,N){
		ull n;cin>>n;
		n = (n-1)%4912;
		cout << dp[n] << endl;
	}


	return 0;
}
0