結果

問題 No.657 テトラナッチ数列 Easy
ユーザー ohreitetsuohreitetsu
提出日時 2018-03-20 22:14:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 51,808 KB
実行使用メモリ 7,064 KB
最終ジャッジ日時 2023-09-06 23:42:24
合計ジャッジ時間 1,577 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
7,044 KB
testcase_01 AC 9 ms
7,004 KB
testcase_02 AC 9 ms
6,928 KB
testcase_03 AC 9 ms
6,992 KB
testcase_04 AC 9 ms
7,064 KB
testcase_05 AC 23 ms
7,000 KB
testcase_06 AC 9 ms
6,888 KB
testcase_07 AC 9 ms
6,928 KB
testcase_08 AC 9 ms
6,872 KB
testcase_09 AC 24 ms
6,876 KB
testcase_10 AC 25 ms
7,024 KB
testcase_11 AC 24 ms
6,916 KB
testcase_12 AC 26 ms
7,004 KB
testcase_13 AC 26 ms
6,892 KB
testcase_14 AC 27 ms
6,924 KB
testcase_15 AC 26 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int *T=new int[1000001];
	int Q;
	cin>>Q;
	int i;
	for (i=1;i<1000001;i++){
		T[i]=0;
	}
	T[4]=1;
	for (i=5;i<1000001;i++){
		T[i]=T[i-1]+T[i-2]+T[i-3]+T[i-4];
		T[i]%=17;
	}
	int n;
	for (i=0;i<Q;i++){
		cin>>n;
		cout<<T[n]<<endl;
	}
	delete[] T;
	return 0;
}
0