結果

問題 No.639 An Ordinary Sequence
ユーザー H3PO4H3PO4
提出日時 2020-10-20 08:53:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 22 ms / 1,000 ms
コード長 217 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 10,584 KB
実行使用メモリ 8,736 KB
最終ジャッジ日時 2023-09-28 13:36:10
合計ジャッジ時間 1,468 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,560 KB
testcase_01 AC 20 ms
8,564 KB
testcase_02 AC 22 ms
8,696 KB
testcase_03 AC 21 ms
8,528 KB
testcase_04 AC 21 ms
8,628 KB
testcase_05 AC 21 ms
8,616 KB
testcase_06 AC 20 ms
8,736 KB
testcase_07 AC 20 ms
8,540 KB
testcase_08 AC 21 ms
8,624 KB
testcase_09 AC 20 ms
8,616 KB
testcase_10 AC 21 ms
8,684 KB
testcase_11 AC 20 ms
8,620 KB
testcase_12 AC 20 ms
8,704 KB
testcase_13 AC 22 ms
8,540 KB
testcase_14 AC 21 ms
8,600 KB
testcase_15 AC 20 ms
8,648 KB
testcase_16 AC 20 ms
8,584 KB
testcase_17 AC 20 ms
8,508 KB
testcase_18 AC 20 ms
8,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from functools import lru_cache

sys.setrecursionlimit(10 ** 9)

N = int(input())


@lru_cache(maxsize=None)
def rec(x):
    if x == 0:
        return 1
    return rec(x // 3) + rec(x // 5)


print(rec(N))
0