Double Factorial
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 356
Solved: 145
- Description
- We all learned the factorial of N is N!=1 * 2 * 3 * … * N(if N>=0).Base on the factorial, we give the parts definition of N>=0 of the DOUBLE FACTORIAL N!!.
Give you a 0 <= N <=18, please calculate the answer S = 0!! + 1!! + 2!! + … N!! - Input
- The first Line is a Number T, means there is T cases.
Next T line, each line is a number N(0 <= N <= 18)
- Output
- For each case, output a line, include the answer number S.
- sample input
-
4 1 2 3 4
- sample output
-
Case #1: 2 Case #2: 4 Case #3: 7 Case #4: 15
- hint
- source
- Hong Zehua, HUST Campus 2009