QOJ.ac

QOJ

Limite de temps : 6 s Limite de mémoire : 524288 MB Points totaux : 100 Hackable ✓

#14034. 美丽数对

Statistiques

小 Vitechka 非常喜欢数论。如果一个正整数对 $(a, b)$ 满足 $a^2 - 1$ 能被 $b$ 整除,且 $b^2 - 1$ 能被 $a$ 整除,他就认为这个数对是美丽的。请帮助 Vitechka 计算满足 $a$ 和 $b$ 都属于闭区间 $[l, r]$ 的美丽数对 $(a, b)$ 的数量。

输入格式

第一行包含一个整数 $n$,表示测试用例的数量($1 \le n \le 10^5$)。

接下来 $n$ 行,每行包含一个测试用例的描述,由两个整数 $l$ 和 $r$ 组成($1 \le l \le r \le 10^{18}$)。

输出格式

对于每个测试用例,在单独的一行中输出答案。

样例

输入样例 1

2
1 6
10 20

输出样例 1

19
20

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.