結果

問題 No.658 テトラナッチ数列 Hard
ユーザー 山本信二山本信二
提出日時 2022-05-23 23:47:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 994 ms
コンパイル使用メモリ 11,836 KB
実行使用メモリ 11,764 KB
最終ジャッジ日時 2023-10-20 17:48:30
合計ジャッジ時間 1,933 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
10,432 KB
testcase_01 AC 73 ms
10,432 KB
testcase_02 AC 73 ms
10,432 KB
testcase_03 AC 73 ms
10,432 KB
testcase_04 AC 82 ms
11,568 KB
testcase_05 AC 82 ms
11,568 KB
testcase_06 AC 83 ms
11,568 KB
testcase_07 AC 84 ms
11,568 KB
testcase_08 AC 83 ms
11,568 KB
testcase_09 AC 84 ms
11,764 KB
testcase_10 AC 84 ms
11,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

Q,*N = map(int,read().split())

U = 17 ** 4 + 10
T = [0] * U
T[0] = 1

for n in range(4,U):
    T[n] = sum(T[n-4:n]) % 17

P = 17 ** 4 - 17

for n in N:
    print(T[n%P])
0