結果

問題 No.658 テトラナッチ数列 Hard
ユーザー amtgjwamtgjw
提出日時 2018-06-06 09:38:00
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 65,116 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 22:41:08
合計ジャッジ時間 1,375 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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+1];

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

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

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


	return 0;
}
0