結果

問題 No.657 テトラナッチ数列 Easy
ユーザー June3141June3141
提出日時 2018-10-14 22:11:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 596 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 19,200 KB
最終ジャッジ日時 2024-04-20 20:20:22
合計ジャッジ時間 4,293 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 489 ms
18,048 KB
testcase_05 AC 42 ms
11,008 KB
testcase_06 AC 28 ms
10,752 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 554 ms
18,688 KB
testcase_09 AC 43 ms
11,136 KB
testcase_10 AC 48 ms
11,264 KB
testcase_11 AC 51 ms
11,520 KB
testcase_12 AC 98 ms
12,032 KB
testcase_13 AC 558 ms
19,072 KB
testcase_14 AC 596 ms
19,200 KB
testcase_15 AC 567 ms
19,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

Q = int(input())
n = [int(input()) for i in range(Q)]

n_max = max(n)
T = [0 for i in range(n_max)]

if n_max >= 4:
    T[3] = 1

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

for i in range(Q):
    print(T[n[i] - 1])
0