結果
問題 | No.658 テトラナッチ数列 Hard |
ユーザー |
|
提出日時 | 2018-03-03 21:12:25 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 125 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-07-04 15:10:53 |
合計ジャッジ時間 | 1,475 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 |
ソースコード
def main(): Q = int(input()) N = tuple(int(input()) for _ in [0] * Q) tetra = [0, 0, 0, 1, 1] apnd = tetra.append i = 1 while 1: if all((not tetra[i], not tetra[i+1], not tetra[i+2], tetra[i+3] == 1)): break else: apnd((tetra[i] + tetra[i+1] + tetra[i+2] + tetra[i+3]) % 17) i += 1 for n in N: print(tetra[(n-1) % (len(tetra) - 4)]) main()