結果
| 問題 | 
                            No.657 テトラナッチ数列 Easy
                             | 
                    
| コンテスト | |
| ユーザー | 
                             zbxah
                         | 
                    
| 提出日時 | 2018-03-05 11:30:54 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 367 bytes | 
| コンパイル時間 | 149 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 18,080 KB | 
| 最終ジャッジ日時 | 2024-07-19 09:05:02 | 
| 合計ジャッジ時間 | 6,655 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 TLE * 1 -- * 3 | 
ソースコード
tetranacci = {1: 0, 2: 0, 3: 0, 4: 1}
Q = int(input())
xs = [int(input()) for _ in range(Q)]
def t(n: int):
    a, b, c, d = tetranacci[4], tetranacci[3], tetranacci[2], tetranacci[1]
    for i in range(5, n + 1):
        a, b, c, d = (a + b + c + d) % 17, a, b, c
        if i in xs:
            tetranacci[i] = a
t(max(xs))
for x in xs:
    print(tetranacci[x])
            
            
            
        
            
zbxah