Codey and Facto
https://www.hackerrank.com/contests/codenection-2023-final-round-open-category/challenges/cn-c9
Last updated
https://www.hackerrank.com/contests/codenection-2023-final-round-open-category/challenges/cn-c9
Last updated
Codey is very interested in facto, a concept he learned in the mathematics class last week.
If you are given an integer n
and an integer m
, a facto of n
and m
is an array of integers such that the product of every element in the array is n
, and the length of the array is m
.
For example, when , one of the facto is , as , and the array's length is . Other examples of facto for include , and .
Codey wants you to find the total number of unique facto that exist for the n
and m
modulo . Recall that a
modulo b
is the remainder of a
when divided by b
.
The first line contains two integers, n
and m
, where n
represents the number n
, and m
represents the number of facto.
Output the total number of unique facto for n
and m
modulo .
facto for includes:
then, let .
For same examples, can be described as:
Meanwhile, can be described as:
Multiply them together,
Finally, as we have ways to arrange the remaining "1"s, so we calculate the permutation of that: