QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 1024 MB Total points: 100 Difficulty: [show]

#6188. Elliptic Curve Problem

الإحصائيات

This problem might be well-known in some countries, but how do other countries learn about such problems if nobody poses them?

设 $p$ 为一个奇素数。计算区间 $[l, r]$ 中二次剩余的个数。

$x$ 是 $p$ 的二次剩余,当且仅当 $x^{(p-1)/2} \equiv 1 \pmod p$。

输入格式

第一行包含 $p, l, r$ ($3 \le p \le 10^{11}, 1 \le l \le r < p$)。保证 $p$ 是一个奇素数。

输出格式

一个整数,即答案。

样例

样例输入 1

11 3 8

样例输出 1

3

样例输入 2

998244353 11451400 919810000

样例输出 2

454174074

样例输入 3

96311898227 25437319919 55129361817

样例输出 3

14846091352

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.