Last active
January 17, 2026 09:15
-
-
Save maehrm/9c4980788c6df4986a6eb056ac81101f to your computer and use it in GitHub Desktop.
D - Yet Another Recursive Function https://atcoder.jp/contests/abc275/tasks/abc275_d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| sys.setrecursionlimit(10**7) | |
| def f(k, memo): | |
| if k in memo: | |
| return memo[k] | |
| else: | |
| memo[k] = f(k // 2, memo) + f(k // 3, memo) | |
| return memo[k] | |
| N = int(input()) | |
| print(f(N, {0: 1})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment