The 4th(2009) ACM Programming Contest of HUST - Onsite Contest

From: 2009-12-06 12:00:00 To: 2009-12-06 17:00:00 Now: 2017-09-20 01:09:32 Status: Public

D - Double Factorial

Time Limit: 1s Memory Limit: 128MB

Submissions: 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