P27837 [洛谷] [Language Competition May 2023] Factorial Calculation
普及-
题目描述

Problem Background

You are already familiar with the definition of factorial:

$$n! = n \times (n - 1) \times (n - 2) \times \dots \times 1$$

Now, we introduce the definition of double factorial:

When $n$ is odd,
$$n!! = n \times (n - 2) \times (n - 4) \times \dots \times 1$$

When $n$ is even,
$$n!! = n \times (n - 2) \times (n - 4) \times \dots \times 2$$

Particularly, $0!! = 1$.

For example, $5!! = 5 \times 3 \times 1 = 15$, and $6!! = 6 \times 4 \times 2 = 48$.

Problem Description

Given an integer $n$, please calculate the value of $2 \times \dfrac{n!}{n!!}$.

Input Format

This problem contains multiple test cases within a single test point.

The first line of input is an integer representing the number of test cases, $T$. The following lines contain the input for each test case.

For each test case, there is a single line with an integer representing the given $n$.

Output Format

For each test case, output a single line containing an integer representing the value of $2 \times \dfrac{n!}{n!!}$.

Sample Input and Output

Sample Input #1

1
2

Sample Output #1

2

Sample Input #2

1
3

Sample Output #2

4

Notes

Data Range and Constraints

  • For $20\%$ of the data, $n \leq 2$.
  • For $60\%$ of the data, $n \leq 9$.
  • For $100\%$ of the data, $0 \leq n \leq 34$, $1 \leq T \leq 35$.

Hints

$2 \times \dfrac{34!}{34!!} < 2^{64}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 2
样例输出
2