結果

問題 No.657 テトラナッチ数列 Easy
ユーザー ryoissyryoissy
提出日時 2018-03-02 22:24:42
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 1,221 ms
コンパイル使用メモリ 142,784 KB
実行使用メモリ 7,668 KB
最終ジャッジ日時 2023-09-03 22:35:28
合計ジャッジ時間 2,029 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
7,572 KB
testcase_01 AC 10 ms
7,368 KB
testcase_02 AC 10 ms
7,576 KB
testcase_03 AC 10 ms
7,428 KB
testcase_04 AC 9 ms
7,572 KB
testcase_05 AC 12 ms
7,376 KB
testcase_06 AC 10 ms
7,444 KB
testcase_07 AC 9 ms
7,580 KB
testcase_08 AC 10 ms
7,668 KB
testcase_09 AC 11 ms
7,480 KB
testcase_10 AC 11 ms
7,496 KB
testcase_11 AC 11 ms
7,416 KB
testcase_12 AC 12 ms
7,368 KB
testcase_13 AC 12 ms
7,372 KB
testcase_14 AC 12 ms
7,352 KB
testcase_15 AC 12 ms
7,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int q;
int t[1000001];

int main(void){
	t[4]=1;
	for(int i=5;i<=1000000;i++){
		t[i]=(t[i-1]+t[i-2]+t[i-3]+t[i-4])%17;
	}
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		int n;
		scanf("%d",&n);
		printf("%d\n",t[n]);
	}
	return 0;
}
0