QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#3753. 9 を法として

Statistics

Bobo は、先頭に 0 が付いていることもある 10 進整数 $\overline{a_1 a_2 \dots a_n}$ を持っています。$m$ 個の区間 $[l_1, r_1], [l_2, r_2], \dots, [l_m, r_m]$ について、$a_{l_i} \times a_{l_i + 1} \times \dots \times a_{r_i} \bmod 9 = 0$ が成り立つことが分かっています。 条件を満たす整数 $\overline{a_1 a_2 \dots a_n}$ の個数を $(10^9+7)$ を法として求めてください。

入力

入力は複数のテストケースからなり、ファイルの終端で終了します。

各テストケースの最初の行には、2 個の整数 $n$ と $m$ が含まれます。

続く $m$ 行のうち $i$ 番目の行には、2 個の整数 $l_i$ と $r_i$ が含まれます。

  • $1 \leq n, m \leq 50$
  • $1 \leq l_i \leq r_i \leq n$
  • テストケースは最大 $100$ 個です。

出力

各テストケースについて、結果を表す整数を一つ出力してください。

入出力例

入力 1

2 1
1 2
4 2
1 3
2 4
50 1
1 50

出力 1

40
4528
100268660

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.