結果

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

ソースコード

diff #

t = [0,0,0,1]
k = 4
v = {}
while True:
    s = tuple(t[-4:])
    if s in v:
        break
    v[s] = k
    k += 1
    t.append(sum(s)%17)
b = v[s]
x = [int(input()) for _ in range(int(input()))]
for n in x:
    if n < b:
        print(t[n-1])
    else:
        print(t[b+(n-1-b)%(k-b)])
0