問題一覧 > 教育的問題

No.1892 Extended Fib Series

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

Problem Statement

Yassu is about to climb a staircase consisting of $N$ steps. In one move, he can climb at most $L$ steps.

Find the number of ways to move, starting from step $0$ and reaching step $N$, and print the remainder when it is divided by $10^9 + 7$.

Input

$N\ L$

  • All inputs are integers.
  • $1 \leq N \leq 10^5$
  • $1 \leq L \leq 10^5$

Output

Print the number of ways to move, modulo $10^9+7$.

Sample

Sample 1
Input
4 3
Output
7

The following are the 7 ways to move that satisfy the conditions:

  • Step $0$ $\rightarrow 1$ Step $\rightarrow 2$ Step $\rightarrow 3$ Step $\rightarrow 4$ Step
  • Step $0$ $\rightarrow 1$ Step $\rightarrow 2$ Step $\rightarrow 4$ Step
  • Step $0$ $\rightarrow 1$ Step $\rightarrow 3$ Step $\rightarrow 4$ Step
  • Step $0$ $\rightarrow 1$ Step $\rightarrow 4$ Step
  • Step $0$ $\rightarrow 2$ Step $\rightarrow 3$ Step $\rightarrow 4$ Step
  • Step $0$ $\rightarrow 2$ Step $\rightarrow 4$ Step
  • Step $0$ $\rightarrow 3$ Step $\rightarrow 4$ Step

Sample 2
Input
1 1
Output
1
Sample 3
Input
1000 50
Output
438993203

Find the remainder when divided by $10^9+7$.

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