結果

問題 No.657 テトラナッチ数列 Easy
ユーザー Ryuto
提出日時 2018-03-19 12:35:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 145,528 KB
最終ジャッジ日時 2024-12-31 10:39:16
合計ジャッジ時間 3,058 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python

def Tn(n, tlist):
    ans = sum(tlist[n-4:n]) % 17
    return ans

Q = int(input())
inval = []
for i in range(Q):
    inval.append(int(input()))
tlist = [0, 0, 0, 0, 1]
nmax = 4

for n in inval:
    if n > nmax:
        for i in range(nmax+1,n+1):
            tlist.append(Tn(i,tlist))
        nmax = n
    print(tlist[n])
0