結果

問題 No.658 テトラナッチ数列 Hard
ユーザー neko_the_shadowneko_the_shadow
提出日時 2018-03-21 22:49:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 7,920 KB
最終ジャッジ日時 2023-09-07 01:06:22
合計ジャッジ時間 1,599 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,824 KB
testcase_01 AC 18 ms
7,844 KB
testcase_02 AC 18 ms
7,788 KB
testcase_03 AC 18 ms
7,792 KB
testcase_04 AC 69 ms
7,916 KB
testcase_05 AC 67 ms
7,920 KB
testcase_06 AC 66 ms
7,852 KB
testcase_07 AC 67 ms
7,872 KB
testcase_08 AC 68 ms
7,788 KB
testcase_09 AC 69 ms
7,872 KB
testcase_10 AC 69 ms
7,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == '__main__':
	ts = [0, 0, 0, 1, 1]
	
	head = ts[0:4]
	while True:
		tail = ts[len(ts)-4:]
		if head == tail:
			break
		ts.append(sum(tail) % 17)

	mod = len(ts) - 4

	q = int(input())
	for _ in range(q):
		n = int(input())
		print(ts[(n - 1) % mod])

0