結果

問題 No.657 テトラナッチ数列 Easy
ユーザー zbxahzbxah
提出日時 2018-03-05 11:11:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 311 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 10,496 KB
実行使用メモリ 7,940 KB
最終ジャッジ日時 2023-09-26 14:12:06
合計ジャッジ時間 6,092 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,836 KB
testcase_01 AC 15 ms
7,788 KB
testcase_02 AC 16 ms
7,800 KB
testcase_03 AC 15 ms
7,904 KB
testcase_04 AC 129 ms
7,808 KB
testcase_05 AC 64 ms
7,784 KB
testcase_06 AC 16 ms
7,888 KB
testcase_07 AC 15 ms
7,776 KB
testcase_08 AC 150 ms
7,940 KB
testcase_09 AC 660 ms
7,828 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def t(n: int) -> int:
    if n in [1, 2, 3]:
        return 0
    elif n == 4:
        return 1
    a, b, c, d = 1, 0, 0, 0  # n-1, ..., n-4
    for _ in range(5, n + 1):
        a, b, c, d = (a + b + c + d) % 17, a, b, c
    return a


Q = int(input())
for _ in range(Q):
    nq = int(input())
    print(t(nq))
0