QOJ.ac

QOJ

时间限制: 3 s 内存限制: 512 MB 总分: 100 可 Hack ✓

#11518. 整数与区间

统计

Isaac 有一个十进制整数 $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} \equiv 0 \pmod 9$。求满足条件的整数 $a_1 a_2 \dots a_n$ 的个数,结果对 $(10^9 + 7)$ 取模。

输入格式

输入包含多组测试数据,以文件结束符(EOF)结束。 每组测试数据的第一行包含两个整数 $n$ 和 $m$。 接下来的 $m$ 行中,第 $i$ 行包含两个整数 $l_i$ 和 $r_i$。

  • $1 \le n, m \le 10^3$
  • $1 \le l_i \le r_i \le 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.