結果
問題 | No.658 テトラナッチ数列 Hard |
ユーザー |
![]() |
提出日時 | 2018-03-04 23:32:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 97 ms / 2,000 ms |
コード長 | 360 bytes |
コンパイル時間 | 243 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-07-17 23:03:01 |
合計ジャッジ時間 | 1,980 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 |
ソースコード
T = { 1: 0, 2: 0, 3: 0, 4: 1 } def tetra(i): if i in T: return T[i] else: t = (tetra(i - 1) % 17 + tetra(i - 2) % 17 + tetra(i - 3) % 17 + tetra(i - 4) % 17) % 17 T[i] = t return t for i in range(5, 4917): tetra(i) Q = int(input()) for _ in range(Q): print(T[(int(input()) - 1) % 4912 + 1])