結果

問題 No.657 テトラナッチ数列 Easy
ユーザー kyo1kyo1
提出日時 2020-11-23 09:53:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 518 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 15,928 KB
最終ジャッジ日時 2023-09-30 23:40:20
合計ジャッジ時間 9,413 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 473 ms
15,748 KB
testcase_01 AC 471 ms
15,756 KB
testcase_02 AC 465 ms
15,764 KB
testcase_03 AC 470 ms
15,768 KB
testcase_04 AC 470 ms
15,804 KB
testcase_05 AC 511 ms
15,772 KB
testcase_06 AC 468 ms
15,780 KB
testcase_07 AC 463 ms
15,756 KB
testcase_08 AC 466 ms
15,760 KB
testcase_09 AC 517 ms
15,856 KB
testcase_10 AC 518 ms
15,776 KB
testcase_11 AC 517 ms
15,776 KB
testcase_12 AC 517 ms
15,744 KB
testcase_13 AC 516 ms
15,752 KB
testcase_14 AC 515 ms
15,828 KB
testcase_15 AC 516 ms
15,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(100000)

T = [-1 for _ in range(pow(10, 6) + 1)]
T[1] = 0
T[2] = 0
T[3] = 0
T[4] = 1


for i in range(5, pow(10, 6) + 1):
    T[i] = (T[i - 1] + T[i - 2] + T[i - 3] + T[i - 4]) % 17


for _ in range(int(input())):
    n = int(input())
    print(T[n])
0