結果

問題 No.658 テトラナッチ数列 Hard
ユーザー hedwig100hedwig100
提出日時 2020-05-12 22:04:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 9,264 KB
最終ジャッジ日時 2023-10-12 00:29:03
合計ジャッジ時間 1,267 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
7,948 KB
testcase_01 AC 18 ms
8,016 KB
testcase_02 AC 17 ms
8,036 KB
testcase_03 AC 18 ms
8,112 KB
testcase_04 AC 40 ms
9,264 KB
testcase_05 AC 40 ms
9,136 KB
testcase_06 AC 40 ms
9,208 KB
testcase_07 AC 41 ms
9,124 KB
testcase_08 AC 41 ms
9,092 KB
testcase_09 AC 41 ms
9,096 KB
testcase_10 AC 42 ms
9,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(100000000)
MOD = 17
INF = 10 ** 15
from bisect import bisect_left,bisect_right

def main():  
    Q = int(input())
    Ns = [int(input()) for _ in range(Q)]
    tetora = [0] * 5000
    tetora[4] = 1
    for i in range(5,5000):
        tetora[i] = sum(tetora[i - 4:i])%MOD
    Ns = [n%4912 if n%4912 != 0 else 4912 for n in Ns]
    print(*[tetora[n] for n in Ns],sep = '\n')
if __name__ == '__main__':
    main()
0