結果

問題 No.657 テトラナッチ数列 Easy
ユーザー hitoyozake
提出日時 2018-04-14 15:56:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 588 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-06-26 22:15:54
合計ジャッジ時間 2,557 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 6 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

# -* encoding: utf-8 *-
import collections


def tetra(map, n):

    if n <= 3:
        return 0
    elif n == 4:
        return 1

    if n not in map:
        map[n] = tetra(map=map, n=n-1) + tetra(map=map, n=n-2) + tetra(map=map, n=n-3) + tetra(map=map, n=n-4)

    return map[n]

def main():
    n = int(input().split()[0])
    ar = []

    mp = {}

    for i in range(n):
        x = int(input().split()[0])

        for i in range(x):
            tetra(map=mp, n=x)

        ar.append(tetra(map=mp, n=x))

    for i in ar:
        print(i%17)


if __name__ == '__main__':
    main()
0