結果

問題 No.639 An Ordinary Sequence
ユーザー lloyz
提出日時 2022-08-18 01:19:37
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 215 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-05 08:28:24
合計ジャッジ時間 1,410 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)

memo = dict()
memo[0] = 1
def rec(n):
    if n in memo:
        return memo[n]
    res = rec(n // 3) + rec(n // 5)
    memo[n] = res
    return res

print(rec(int(input())))
0