結果

問題 No.657 テトラナッチ数列 Easy
ユーザー hedwig100hedwig100
提出日時 2020-05-12 21:25:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 17,028 KB
最終ジャッジ日時 2023-10-11 23:36:19
合計ジャッジ時間 6,013 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 256 ms
15,956 KB
testcase_01 AC 258 ms
15,800 KB
testcase_02 AC 259 ms
15,744 KB
testcase_03 AC 259 ms
15,920 KB
testcase_04 AC 258 ms
15,812 KB
testcase_05 AC 277 ms
16,612 KB
testcase_06 AC 258 ms
15,824 KB
testcase_07 AC 260 ms
15,792 KB
testcase_08 AC 257 ms
15,904 KB
testcase_09 AC 277 ms
16,672 KB
testcase_10 AC 278 ms
17,028 KB
testcase_11 AC 279 ms
16,864 KB
testcase_12 AC 280 ms
16,888 KB
testcase_13 AC 277 ms
17,012 KB
testcase_14 AC 279 ms
16,896 KB
testcase_15 AC 279 ms
17,000 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] * 1000001
    tetora[4] = 1
    for i in range(5,1000001):
        tetora[i] = tetora[i - 1] + tetora[i - 2] + tetora[i - 3] + tetora[i - 4]
        tetora[i] %= MOD
    print(*[tetora[q] for q in Ns],sep = '\n')
if __name__ == '__main__':
    main()
0