atcoder#ABC199E. [ABC199E] Permutation
[ABC199E] Permutation
Score : points
Problem Statement
Print the number of sequences that are permutations of and satisfy the following condition:
- for every integer such that , at most numbers among are less than or equal to .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3 1
2 2 1
4
The four sequences satisfying the condition are:
and violate the condition, since each of them has two numbers less than or equal to among .
5 2
3 3 2
4 4 3
90
18 0
6402373705728000