#P2401. Counting Permutations with k Ascents

    ID: 15672 Type: Default 1000ms 256MiB

Counting Permutations with k Ascents

Counting Permutations with k Ascents

Given an integer n and an integer k, consider all the permutations of the set \(\{1,2,\dots,n\}\). For each permutation, examine every pair of consecutive numbers and insert a symbol \(\). Your task is to count how many permutations yield exactly \(k\) occurrences of the \(<\) sign. Since the answer can be large, output it modulo \(2015\).

Note: A permutation of \(\{1,2,\dots,n\}\) means every number appears exactly once.

inputFormat

The input consists of two integers n and k separated by spaces. Here, n represents the length of the permutation and k is the number of \(<\) signs required.

outputFormat

Output a single integer which is the number of valid permutations modulo \(2015\).

sample

1 0
1