#C9774. Count Ways to Form Pairs with Constraint
Count Ways to Form Pairs with Constraint
Count Ways to Form Pairs with Constraint
Given an even positive integer N representing the number of students, your task is to count the number of ways to form pairs such that student 1 is always included in the first pair. In other words, after fixing a partner for student 1, the remaining N - 2 students are paired in all possible ways.
The value is computed using the formula:
$$ (N - 1) \times \frac{(N-2)!}{2^{\frac{N-2}{2}}\left(\frac{N-2}{2}\right)!} $$
It is guaranteed that N will always be even and at least 2.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer T, the number of test cases.
- Each of the following T lines contains one even integer N (N ≥ 2) representing the number of students in that test case.
outputFormat
For each test case, print a single line to standard output (stdout) containing the number of ways to form pairs under the given constraints.
## sample3
2
4
6
1
3
15
</p>