結果

問題 No.657 テトラナッチ数列 Easy
ユーザー winspyrwinspyr
提出日時 2018-05-06 16:55:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 51,680 KB
実行使用メモリ 7,428 KB
最終ジャッジ日時 2023-09-10 10:46:16
合計ジャッジ時間 1,818 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
7,312 KB
testcase_01 AC 10 ms
7,240 KB
testcase_02 AC 10 ms
7,316 KB
testcase_03 AC 10 ms
7,332 KB
testcase_04 AC 10 ms
7,252 KB
testcase_05 AC 24 ms
7,376 KB
testcase_06 AC 10 ms
7,244 KB
testcase_07 AC 10 ms
7,240 KB
testcase_08 AC 10 ms
7,428 KB
testcase_09 AC 29 ms
7,324 KB
testcase_10 AC 26 ms
7,252 KB
testcase_11 AC 26 ms
7,248 KB
testcase_12 AC 26 ms
7,320 KB
testcase_13 AC 28 ms
7,236 KB
testcase_14 AC 27 ms
7,292 KB
testcase_15 AC 28 ms
7,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

using namespace std;

int n[10005];
int t[1000005];

int main()
{
	int q;cin>>q;
	t[0] = 0; t[1]=0;t[2]=0;t[3]=0;t[4]=1;
	int idx = 5;
	while(1)
	{
		t[idx] = t[idx-1]+t[idx-2]+t[idx-3]+t[idx-4];
		t[idx] %= 17;
		idx++;
		if(idx > 1000000) break;
	}
	
	for(int i=0;i<q;i++)
	{
		int n;cin>>n;
		cout << t[n] << endl;
	}
	
	return 0;
	
}
0