結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,788 KB
testcase_01 AC 17 ms
7,904 KB
testcase_02 AC 17 ms
7,896 KB
testcase_03 AC 16 ms
7,792 KB
testcase_04 AC 162 ms
7,780 KB
testcase_05 AC 39 ms
8,644 KB
testcase_06 AC 17 ms
7,804 KB
testcase_07 AC 16 ms
7,780 KB
testcase_08 AC 252 ms
7,948 KB
testcase_09 AC 55 ms
8,892 KB
testcase_10 AC 895 ms
9,212 KB
testcase_11 AC 889 ms
9,120 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

tetranacci = {1: 0, 2: 0, 3: 0, 4: 1}
Q = int(input())
xs = [int(input()) for _ in range(Q)]


def t(n: int):
    a, b, c, d = tetranacci[4], tetranacci[3], tetranacci[2], tetranacci[1]
    for i in range(5, n + 1):
        a, b, c, d = (a + b + c + d) % 17, a, b, c
        if i in xs:
            tetranacci[i] = a


t(max(xs))
for x in xs:
    print(tetranacci[x])
0