結果

問題 No.658 テトラナッチ数列 Hard
ユーザー 👑 rin204
提出日時 2020-08-05 17:40:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-17 06:57:08
合計ジャッジ時間 1,843 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

tt = [0, 0, 0, 1]
while 1:
    num = tt[-1] + tt[-2] + tt[-3] + tt[-4]
    num %= 17
    tt.append(num)
    if tt[:4] == tt[-4:]:
        break

tt = tt[:-4]
l = len(tt)
q = int(input())
for _ in range(q):
    n = int(input())
    n %= l
    print(tt[n - 1])
    
0