問題一覧 > 通常問題

No.823 Many Shifts Easy

レベル : / AI推定難易度 : 1500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 124
作問者 : Pulmn / テスター : e869120
お気に入りにしたユーザー ProblemId : 2446 / 自分の提出
問題文最終更新日: 2019-04-26 23:41:05
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 212 (順位表) の他の問題:

Problem Statement

There are $N+1$ squares arranged in a row, numbered $0,1,\dots,N$ from left to right. Each of the squares numbered $1$ through $N$ has $1$ piece placed on it.
Here, for an integer sequence $A$ of length $K$ with elements between $1$ and $N$ inclusive and $\large \textbf{all elements pairwise distinct}$, define its score as the sum of the numbers of the squares that have at least $1$ piece on them after performing the following operation.

Operation: for $i=1,2,\dots,K$ in this order, move all pieces on square $A_i$ to square $A_i-1$

There are ${}_N\mathrm {P}_ K$ integer sequences of length $K$ with elements between $1$ and $N$ inclusive and $\large \textbf{all elements pairwise distinct}$.
Compute the score for every integer sequence with $\large \textbf{all elements pairwise distinct}$, and find the sum of the scores modulo $10^9+7$.

Input

$N$ $K$

$1\le K\le N\le 10^5$

Output

Output the sum of the scores over all integer sequences with $\large \textbf{all elements pairwise distinct}$, modulo $10^9+7$. Print a newline at the end.

Sample

Sample 1
Input
6 4
Output
3600

For the case $A=(2,1,5,4)$:

$i=1$: Square $2$ has $1$ piece on it, and that piece is moved to square $1$
$i=2$: Square $1$ has $2$ pieces on it, and those pieces are moved to square $0$
$i=3$: Square $5$ has $1$ piece on it, and that piece is moved to square $4$
$i=4$: Square $4$ has $2$ pieces on it, and those pieces are moved to square $3$

In the end, squares $0,3,6$ each have at least $1$ piece on them, so the score of the permutation $A=\{2,3,1,4\}$ is $0+3+6=9$

Sample 2
Input
1 1
Output
0

Sample 3
Input
1000 100
Output
45281982

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