結果

問題 No.658 テトラナッチ数列 Hard
ユーザー hedwig100
提出日時 2020-05-12 22:04:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-09-14 00:23:54
合計ジャッジ時間 1,338 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(100000000)
MOD = 17
INF = 10 ** 15
from bisect import bisect_left,bisect_right

def main():  
    Q = int(input())
    Ns = [int(input()) for _ in range(Q)]
    tetora = [0] * 5000
    tetora[4] = 1
    for i in range(5,5000):
        tetora[i] = sum(tetora[i - 4:i])%MOD
    Ns = [n%4912 if n%4912 != 0 else 4912 for n in Ns]
    print(*[tetora[n] for n in Ns],sep = '\n')
if __name__ == '__main__':
    main()
0