atcoder#AGC005D. [AGC005D] ~K Perm Counting
[AGC005D] ~K Perm Counting
Score : points
Problem Statement
Snuke loves permutations. He is making a permutation of length .
Since he hates the integer , his permutation will satisfy the following:
- Let the permutation be . For each , .
Among the permutations of length , how many satisfies this condition?
Since the answer may be extremely large, find the answer modulo (prime).
Constraints
Input
The input is given from Standard Input in the following format:
Output
Print the answer modulo .
3 1
2
permutations , satisfy the condition.
4 1
5
permutations , , , , satisfy the condition.
4 2
9
4 3
14
425 48
756765083