Permutations and Increasing Sequences
Time limit2sMemory limit1024 MB
Count permutations of 1 to N whose length-K window sums strictly increase, printed modulo 1e9+7.
- Level
Medium4 of 10
- Topics
- Math, Combinatorics, Array
- Solved
- No attempts yet
문제
Geondeok, who liked playing with permutations, found a beautiful property in a sequence he built. His permutation satisfies two conditions. First, contains every integer from 1 to exactly once. Second, the sequence formed by adding consecutive terms of is an increasing sequence. That is, for .
For example, if and , then , so both conditions hold.
Geondeok wants to know how many permutations have this property. Help him count, for given and , the permutations of length that satisfy both conditions.
입력
The first line contains two integers and , separated by a space.
출력
Print the number of permutations of length that satisfy the property, modulo .