結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
76,644 KB
testcase_01 AC 96 ms
76,424 KB
testcase_02 AC 94 ms
76,752 KB
testcase_03 AC 95 ms
76,492 KB
testcase_04 AC 113 ms
77,804 KB
testcase_05 AC 111 ms
78,080 KB
testcase_06 AC 111 ms
77,988 KB
testcase_07 AC 110 ms
77,816 KB
testcase_08 AC 109 ms
77,872 KB
testcase_09 AC 112 ms
77,968 KB
testcase_10 AC 112 ms
77,772 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