問題一覧 > 通常問題

No.535 How to Store Natural Numbers

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

Problem Statement

MAK loves natural numbers.

MAK has at least $N$ copies of each natural number from $1$ to $N$. He decided to store some of the natural numbers he owns in boxes. Conveniently, $N$ mutually distinguishable boxes are lined up in a row in front of him. He plans to store $1$ of the natural numbers he owns in each box, but the following condition must be satisfied. Here, let $A_i$ denote the natural number stored in the $i$-th box from the left.

・For every $i$ satisfying $1\le i\le N$, letting $\begin{eqnarray}L=\begin{cases}N&(i=1)\\i-1&(i\neq 1) \end{cases}\end{eqnarray}$  $\begin{eqnarray}R=\begin{cases}i+1&(i\neq N)\\1&(i=N) \end{cases}\end{eqnarray}$ , it holds that $A_L-L\lt A_i\lt A_R+R$.

MAK wondered how many ways there are to store the natural numbers so that the above condition is satisfied. Since this value can be very large, output the remainder when it is divided by $1{,}000{,}000{,}007=10^9+7$.

Input

$N$

$3\le N\le 2{,}000$

Output

Output the remainder when the number of ways to store the numbers satisfying the condition is divided by $1{,}000{,}000{,}007$. Print a newline at the end.

Sample

Sample 1
Input
3
Output
7

The ways to store the natural numbers satisfying the condition are the following 7: $\{1,1,1\},\{1,2,1\},\{2,2,1\},\{2,2,2\},\{2,3,2\},\{3,3,2\},\{3,3,3\}$.

Sample 2
Input
5
Output
366

For example, $\{3,4,5,4,2\}$ satisfies the condition.

Sample 3
Input
100
Output
35646100

Note that the value to output is the remainder when divided by $1{,}000{,}000{,}007$.

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