#122Easy
Double factorial
Time: 1 s · Memory: 256 MB
- Recursion
Statement
The double factorial is the product of numbers from downwards in steps of two: , . . Compute with a recursive function.
Input format
A single integer ().
Output format
A single integer — .
Examples
Input
7
Output
105
Input
8
Output
384
Note
Recursive step: . There are two base cases: (even ends here) and (odd ). They can be merged into "if , return ". still fits in a 64-bit type.
