結果

問題 No.657 テトラナッチ数列 Easy
ユーザー koba-e964koba-e964
提出日時 2021-09-27 12:50:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 78,024 KB
最終ジャッジ日時 2023-09-20 13:09:52
合計ジャッジ時間 2,879 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
76,456 KB
testcase_01 AC 87 ms
76,380 KB
testcase_02 AC 88 ms
76,484 KB
testcase_03 AC 88 ms
76,560 KB
testcase_04 AC 88 ms
76,236 KB
testcase_05 AC 101 ms
77,208 KB
testcase_06 AC 87 ms
76,276 KB
testcase_07 AC 88 ms
76,584 KB
testcase_08 AC 88 ms
76,320 KB
testcase_09 AC 101 ms
78,024 KB
testcase_10 AC 102 ms
78,008 KB
testcase_11 AC 102 ms
77,964 KB
testcase_12 AC 101 ms
77,800 KB
testcase_13 AC 103 ms
77,832 KB
testcase_14 AC 105 ms
77,736 KB
testcase_15 AC 103 ms
77,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

t = [0, 0, 0, 1]
while t[len(t) - 4:] != [1, 0, 0, 0]:
    s = sum(t[len(t) - 4:]) % 17
    t.append(s)

p = len(t) - 3

q = int(readline())
for _ in range(q):
    n = int(readline())
    print(t[(n - 1) % p])
0