Yet Another Recursive Function

AtCoder
IDabc275_d
Time2000ms
Memory256MB
Difficulty
A function $f(x)$ defined for non-negative integers $x$ satisfies the following conditions. * $f(0) = 1$. * $f(k) = f(\lfloor \frac{k}{2}\rfloor) + f(\lfloor \frac{k}{3}\rfloor)$ for any positive integer $k$. Here, $\lfloor A \rfloor$ denotes the value of $A$ rounded down to an integer. Find $f(N)$. ## Constraints * $N$ is an integer satisfying $0 \le N \le 10^{18}$. ## Input The input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
2
Output #1
3

We have $f(2) = f(\lfloor \frac{2}{2}\rfloor) + f(\lfloor \frac{2}{3}\rfloor) = f(1) + f(0) =(f(\lfloor \frac{1}{2}\rfloor) + f(\lfloor \frac{1}{3}\rfloor)) + f(0) =(f(0)+f(0)) + f(0)= 3$.
Input #2
0
Output #2
1
Input #3
100
Output #3
55
API Response (JSON)
{
  "problem": {
    "name": "Yet Another Recursive Function",
    "description": {
      "content": "A function $f(x)$ defined for non-negative integers $x$ satisfies the following conditions. *   $f(0) = 1$. *   $f(k) = f(\\lfloor \\frac{k}{2}\\rfloor) + f(\\lfloor \\frac{k}{3}\\rfloor)$ for any positive",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc275_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "A function $f(x)$ defined for non-negative integers $x$ satisfies the following conditions.\n\n*   $f(0) = 1$.\n*   $f(k) = f(\\lfloor \\frac{k}{2}\\rfloor) + f(\\lfloor \\frac{k}{3}\\rfloor)$ for any positive...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments