結果

問題 No.658 テトラナッチ数列 Hard
ユーザー koba-e964koba-e964
提出日時 2021-09-27 12:46:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 78,000 KB
最終ジャッジ日時 2023-09-20 13:01:11
合計ジャッジ時間 2,413 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
76,416 KB
testcase_01 AC 92 ms
76,412 KB
testcase_02 AC 90 ms
76,444 KB
testcase_03 AC 88 ms
76,456 KB
testcase_04 AC 103 ms
78,000 KB
testcase_05 AC 102 ms
77,880 KB
testcase_06 AC 101 ms
77,760 KB
testcase_07 AC 102 ms
77,760 KB
testcase_08 AC 104 ms
77,800 KB
testcase_09 AC 104 ms
77,952 KB
testcase_10 AC 103 ms
77,940 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