No.2326 Factorial to the Power of Factorial to the...
問題文最終更新日: 2023-05-23 18:38:38
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
MMA Contest 015
(順位表)
の他の問題:
Problem Statement
You are given positive integers $N, P$. How many times can $N! ^ {\left(N! ^ {N!}\right)}$ be divided by $P$?
Since the answer can be very large, output it $\! \! \! \mod 10 ^ 9 + 7$.
Input
$N\ P$
- $1 \leq N \leq 10 ^ 5$
- $2 \leq P \leq 10 ^ 5$
- $P$ is prime
- All inputs are integers
Output
Output the result in $1$ line.
Sample
Sample 1
Input
2 2
Output
4
Since $2! ^ {(2! ^ {2!})} = 2 ^ {(2 ^ 2)} = 16$, it can be divided by $2$ exactly $4$ times.
Sample 2
Input
6 3
Output
957354861
Note that the output must be taken $\! \! \! \mod 10 ^ 9 + 7$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
sepa38