問題一覧 > 通常問題

No.1269 I hate Fibonacci Number

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

Problem Statement

The Fibonacci sequence $\{F_i\}$ is the sequence defined by $F_0 = F_1 = 1, \ F_{i+2} = F_{i+1} + F_i \ (i \geq 0)$. A number contained in the Fibonacci sequence is called a Fibonacci number.

Find the number, modulo $10^9+7$, of positive integers $M$ satisfying all of the following. Here, the number of digits and so on are all considered in base 10.

  • The number of digits of $M$ is at most $N$.
  • When $M$ is viewed as a string, none of its contiguous substrings, taken as a number, is a Fibonacci number between $L$ and $R$, inclusive.

For example, $M=1305$ contains the Fibonacci numbers $1,3,5,05,13$ as contiguous substrings. ($05$ is equivalent to $5$.)

Input

$N\ L\ R$

  • All inputs are integers.
  • $1 \leq N \leq 5000$
  • $1 \leq L \leq R \leq 10^{18}$

Output

Output the number of $M$ satisfying the conditions, modulo $10^9+7$.

Sample

Sample 1
Input
1 1 9
Output
4

The Fibonacci numbers between 1 and 9, inclusive, are 1, 2, 3, 5, 8. The positive integers with at most 1 digit that do not contain any of these are the 4 numbers 4, 6, 7, 9.

Sample 2
Input
2 2 2
Output
80

There are 80 positive integers with at most 2 digits that do not contain the Fibonacci number 2.

Sample 3
Input
100 123 456789101112
Output
629926418

Find the answer modulo $10^9+7$.

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