QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 256 MB 満点: 100

#15752. 素数

統計

设 $m$ 和 $n$ 为两个整数,$2 \le m < n \le 10000000$。考虑以下集合:

$$Prime(m, n) = \{ p \mid p \text{ 为质数且 } m \le p \le n \}$$

计算集合 $Prime(m, n)$ 的元素个数(基数)。

输入格式

输入包含多个测试用例。每个测试用例的输入占一行。任意两个相邻的测试用例之间用一个空行隔开。对于每个测试用例,$m$ 和 $n$ 的值在同一行中给出,中间恰好用一个空格隔开。

输出格式

对于每个测试用例,计算结果将输出到单独的一行中(测试用例的顺序与输入中的顺序相同)。任意两个相邻测试用例的输出结果之间用一个空行隔开。对于每个测试用例,输出结果为集合 $Prime(m, n)$ 的元素个数。

样例

输入样例 1

2 20

70 110

5 150

输出样例 1

8

10

33

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.