1부터 N까지의 순열을 각각 소수로 바꾼 뒤, 길이가 K 이상인 모든 연속 부분수열에서 가장 작은 K개 값의 곱을 구할 때 서로 다른 곱의 개수가 주어진 P가 되는 순열의 수를 구한다.
어려움8조합론동적 계획법수학정수론아직 제출이 없습니다시간 제한2초메모리 제한512 MBPesho is crypting a sequence of N numbers where each integer from 1 to N appears exactly once. He is using the following algorithm:
Let us see how Pesho should crypt the sequence {4, 1, 3, 2}:
Pesho obtains the new sequence {7, 2, 5, 3}.
{7}, {2}, {5}, {3}, {7, 2}, {2, 5}, {5, 3}, {7, 2, 5}, {2, 5, 3}, {7, 2, 5 ,3}
Pesho removes all subsequences with less than K=2 elements and for each of the rest he computes the product of the smallest K=2 elements.
He writes the numbers {14, 10, 15, 10, 6, 6}
Pesho quickly figured out that the algorithm is much better than he expected. He cannot always decrypt the code unambiguously.
Write a program crypto, which given a code calculates the number of possible initial sequences. Find the answer modulo 1 000 000 007.
The first line contains the positive integers N, K and P.
Print the number of possible initial sequences with code “N K P”. Print the answer modulo 1 000 000 007.