結果

問題 No.657 テトラナッチ数列 Easy
ユーザー 双六双六
提出日時 2020-07-25 15:30:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 88,712 KB
最終ジャッジ日時 2023-09-09 13:48:27
合計ジャッジ時間 3,831 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
85,460 KB
testcase_01 AC 127 ms
85,500 KB
testcase_02 AC 124 ms
85,348 KB
testcase_03 AC 122 ms
85,648 KB
testcase_04 AC 124 ms
85,512 KB
testcase_05 AC 172 ms
88,656 KB
testcase_06 AC 124 ms
85,196 KB
testcase_07 AC 128 ms
85,460 KB
testcase_08 AC 124 ms
85,600 KB
testcase_09 AC 176 ms
88,692 KB
testcase_10 AC 172 ms
88,548 KB
testcase_11 AC 173 ms
88,564 KB
testcase_12 AC 180 ms
88,476 KB
testcase_13 AC 172 ms
88,408 KB
testcase_14 AC 175 ms
88,712 KB
testcase_15 AC 173 ms
88,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

import random

#処理内容
def main():
	Q = int(input())
	tet = [0] * (10 ** 6 + 1)
	tet[3] = 1
	for i in range(4, 10 ** 6 + 1):
		tet[i] = (tet[i - 1] + tet[i - 2] + tet[i - 3] + tet[i - 4]) % 17

	for i in range(Q):
		n = int(input())
		print(tet[n - 1])


	
if __name__ == '__main__':
	main()
0