結果

問題 No.657 テトラナッチ数列 Easy
ユーザー aaaa3215aaaa3215
提出日時 2018-04-04 15:34:21
言語 C
(gcc 12.3.0)
結果
RE  
実行時間 -
コード長 485 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 28,432 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 15:48:56
合計ジャッジ時間 2,515 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>

int main(void) {
	int Q;
	int n[1000];
	int e;
	int j, k, i;

	scanf("%d", &Q);
	for (i = 0; i < Q; i++) {
		scanf("%d", &n[i]);
	}
	
	for (k = 0; k < Q; k++) {
		int a = 0;
		int b = 0;
		int c = 0;
		int d = 1;

		if (n[k] < 4) {
			printf("0\n");
		}

		else if (n[k] == 4) {
			printf("1\n");
		}

		else {
			for (j = 5; j <= n[k]; j++) {
				e = (a + b + c + d) % 17;
				a = b;
				b = c;
				c = d;
				d = e;
			}
			printf("%d\n", e);
		}
	}

	return 0;

}
0