No.660 Random Walk That Does Not Pass the House
タグ : / 解いたユーザー数 67
作問者 :
しらっ亭
/ テスター :
夕叢霧香(ゆうむらきりか)
Problem Statement
Yukiko is standing on a one-dimensional road that extends infinitely east and west. She is trying to return to her home, which is located $N$ steps east of her current position.
However, Yukiko is drunk and unsteady on her feet. So, whenever she tries to walk, she moves $1$ step either east or west.
If Yukiko walks more than $2 \times N$ steps, she gets tired and stops walking, and cannot get home.
When Yukiko reaches the position of her home, she always stops walking and enters her home. She does not walk any further after that.
Output the total number of possible ways of walking in which she enters her home before getting tired, that is, in at most $2 \times N$ steps. Since this value can be very large, output it modulo $10^9+7$.
Input
N
$ 1 \le N \le 2 \times 10^5 $
Output
Output the total number of ways of walking until she gets home, modulo $10^9+7$, followed by a newline.
Sample
Sample 1
Input
2
Output
3
There are the following 3 ways of walking that get her home within 4 steps.
- → →
- → ← → →
- ← → → →
Note that the following ways of walking are impossible, because she enters her home at the 2nd step.
- → → ← →
- → → → ←
Sample 2
Input
6
Output
144
There are a lot of them, aren't there?
Sample 3
Input
10
Output
9878
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。