25. Round Table Conference Seating
Difficulty: easy · Math
Problem
An international round table conference will be held in India with `N` members, including the President and the Prime Minister of India, who must always sit next to each other. Count the seatings the way the organisers do: treat the President and Prime Minister as a single unit. The resulting `N - 1` units can be arranged in `(N - 1)!` ways, and the two leaders can swap places within their unit in `2!` ways. So the number of ways is `P = 2 * (N - 1)!`. For example, with `N = 4` the answer is `2 * 3! = 12`. Print `P` exactly (it can be very large).
Input
A single line containing the integer `N`.
Output
Print `P` as an exact integer, with no modulo.
Example 1
Input: 4 Output: 12
Explanation: The leaders form one unit, so there are 3 units: 3! = 6 arrangements, times 2 for the leaders' order, which gives 12.
Example 2
Input: 10 Output: 725760
Explanation: 2 * 9! = 2 * 362880 = 725760.
Constraints
- 2 <= N <= 100
Solutions are judged against 2 sample and 10 hidden tests. Sign in to solve it · All problems