問題一覧 > 通常問題

No.1050 Zero (Maximum)

レベル : / AI推定難易度 : 1250 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 195
作問者 : stoq / テスター : tran0826
お気に入りにしたユーザー ProblemId : 4093 / 自分の提出
問題文最終更新日: 2020-05-08 10:09:53
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
yukicoder contest 247 (順位表) の他の問題:

Problem Statement

Q-kun has an integer $N$. Initially, $N=0$.
Each time, Q-kun chooses one of the following operations (1) and (2) and performs it. He repeats this $K$ times.

(1) Choose an integer $i \ (0 \leq i \leq M-1)$. Then replace $N$ with the remainder of $N+i$ divided by $M$.
(2) Choose an integer $i \ (0 \leq i \leq M-1)$. Then replace $N$ with the remainder of $N \times i$ divided by $M$.

How many sequences of operations result in $N=0$ again after the $K$ operations? Find the total number of such sequences of operations, modulo $10^9+7$.
Here, two sequences of operations are different if there exists some $i \ (1 \leq i \leq K)$ such that the $i$-th operations differ (that is, they differ in whether (1) or (2) is used, or in the value added/multiplied).

Input

$M\ K$

$M,K$ are integers.
$1 \leq M \leq 50$
$1 \leq K \leq 10^9$

Output

Output the number of sequences of operations satisfying the condition, modulo $10^9+7$. Print a newline at the end.

Sample

Sample 1
Input
3 1
Output
4

The following 4 operations (sequences) satisfy the condition.
・Add 0.
・Multiply by 0.
・Multiply by 1.
・Multiply by 2.

Sample 2
Input
10 53
Output
268129654

Note that you should output the remainder modulo $10^9+7$.

Sample 3
Input
50 100
Output
429346442

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。