QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓

#1902. 计算民族志

الإحصائيات

L 岛的原住民书写数字的方式与我们相反:数字的最高位写在最后。例如,数字 144 会被写成 441。

初级民族志数学家 Petya 正在研究平方数以及 L 岛原住民的文化。他注意到,有些数字在作为普通数字和作为 L 岛原住民书写的数字时,都是完全平方数。例如,上面提到的数字 144 就是这样一个数:当按通常方式书写时,$144 = 12^2$;而当作为原住民书写的数字 441 时,$441 = 21^2$。Petya 将这样的数字称为“有趣的”。

Petya 想知道在 $A$ 到 $B$(包含 $A$ 和 $B$)之间有多少个有趣的数字。

输入格式

输入的第一行包含整数 $A$,第二行包含整数 $B$ ($1 \le A \le B \le 10^{11}$)。

输出格式

输出 $A$ 到 $B$ 之间有趣的数字个数。

样例

输入 1

1
1000

输出 1

10

说明

在第一个样例测试中,有趣的数字有 1, 4, 9, 121, 144, 169, 441, 484, 676 和 961。L 岛的原住民在书写数字时不使用前导零,因此 100 不是一个有趣的数字。

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.