Double Factorial

AtCoder
IDabc148_e
Time2000ms
Memory256MB
Difficulty
For an integer $n$ not less than $0$, let us define $f(n)$ as follows: * $f(n) = 1$ (if $n < 2$) * $f(n) = n f(n-2)$ (if $n \geq 2$) Given is an integer $N$. Find the number of trailing zeros in the decimal notation of $f(N)$. ## Constraints * $0 \leq N \leq 10^{18}$ ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
12
Output #1
1

$f(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080$, which has one trailing zero.
Input #2
5
Output #2
0

$f(5) = 5 × 3 × 1 = 15$, which has no trailing zeros.
Input #3
1000000000000000000
Output #3
124999999999999995
API Response (JSON)
{
  "problem": {
    "name": "Double Factorial",
    "description": {
      "content": "For an integer $n$ not less than $0$, let us define $f(n)$ as follows: *   $f(n) = 1$ (if $n < 2$) *   $f(n) = n f(n-2)$ (if $n \\geq 2$) Given is an integer $N$. Find the number of trailing zeros in",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc148_e"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "For an integer $n$ not less than $0$, let us define $f(n)$ as follows:\n\n*   $f(n) = 1$ (if $n < 2$)\n*   $f(n) = n f(n-2)$ (if $n \\geq 2$)\n\nGiven is an integer $N$. Find the number of trailing zeros in...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments