309795: CF1737B. Ela's Fitness and the Luxury Number

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Ela's Fitness and the Luxury Number

题意翻译

定义一种“奢侈数”为满足 $\lfloor \sqrt{x} \rfloor$ 是 $x$ 的因数的 $x$ 。 求 $l$ 到 $r$ 之间有多少个“奢侈数”。(闭区间)

题目描述

![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1737B/4125e6582413ec975c7a146ffd0b0032ff15910a.png)While working at DTL, Ela is very aware of her physical and mental health. She started to practice various sports, such as Archery, Yoga, and Football.Since she started engaging in sports activities, Ela switches to trying a new sport on days she considers being "Luxury" days. She counts the days since she started these activities, in which the day she starts is numbered as day $ 1 $ . A "Luxury" day is the day in which the number of this day is a luxurious number. An integer $ x $ is called a luxurious number if it is divisible by $ {\lfloor \sqrt{x} \rfloor} $ . Here $ \lfloor r \rfloor $ denotes the "floor" of a real number $ r $ . In other words, it's the largest integer not greater than $ r $ . For example: $ 8 $ , $ 56 $ , $ 100 $ are luxurious numbers, since $ 8 $ is divisible by $ \lfloor \sqrt{8} \rfloor = \lfloor 2.8284 \rfloor = 2 $ , $ 56 $ is divisible $ \lfloor \sqrt{56} \rfloor = \lfloor 7.4833 \rfloor = 7 $ , and $ 100 $ is divisible by $ \lfloor \sqrt{100} \rfloor = \lfloor 10 \rfloor = 10 $ , respectively. On the other hand $ 5 $ , $ 40 $ are not, since $ 5 $ are not divisible by $ \lfloor \sqrt{5} \rfloor = \lfloor 2.2361 \rfloor = 2 $ , and $ 40 $ are not divisible by $ \lfloor \sqrt{40} \rfloor = \lfloor 6.3246 \rfloor = 6 $ . Being a friend of Ela, you want to engage in these fitness activities with her to keep her and yourself accompanied (and have fun together, of course). Between day $ l $ and day $ r $ , you want to know how many times she changes the activities.

输入输出格式

输入格式


Each test contains multiple test cases. The first line has the number of test cases $ t $ ( $ 1 \le t \le 10\ 000 $ ). The description of the test cases follows. The only line of each test case contains two integers $ l $ and $ r $ ( $ 1 \le l \le r \le 10^{18} $ ) — the intervals at which you want to know how many times Ela changes her sports.

输出格式


For each test case, output an integer that denotes the answer.

输入输出样例

输入样例 #1

5
8 19
8 20
119 121
1 100000000000000000
1234567891011 1000000000000000000

输出样例 #1

5
6
2
948683296
2996666667

说明

In the first test case, $ 5 $ luxury numbers in range $ [8, 19] $ are: $ 8, 9, 12, 15, 16 $ .

Input

题意翻译

定义一种“奢侈数”为满足 $\lfloor \sqrt{x} \rfloor$ 是 $x$ 的因数的 $x$ 。 求 $l$ 到 $r$ 之间有多少个“奢侈数”。(闭区间)

Output

**题意翻译**

定义“奢侈数”为满足 $\lfloor \sqrt{x} \rfloor$ 是 $x$ 的因数的 $x$ 。求 $l$ 到 $r$ 之间有多少个“奢侈数”。(闭区间)

**题目描述**

Ela在DTL工作期间非常注重她的身心健康。她开始练习各种运动,比如射箭、瑜伽和足球。自从她开始参与体育活动以来,在那些她认为是“奢侈”的日子里,她会尝试一项新的运动。她从开始这些活动的日子开始计数,开始的那天被标记为第1天。一个“奢侈”日是指当天的编号是一个奢侈数。

一个整数 $x$ 被称为奢侈数,如果它可以被 ${\lfloor \sqrt{x} \rfloor}$ 整除。

这里 $\lfloor r \rfloor$ 表示实数 $r$ 的“下取整”。换句话说,它是小于或等于 $r$ 的最大整数。

例如:$8$、$56$、$100$ 都是奢侈数,因为 $8$ 可以被 $\lfloor \sqrt{8} \rfloor = \lfloor 2.8284 \rfloor = 2$ 整除,$56$ 可以被 $\lfloor \sqrt{56} \rfloor = \lfloor 7.4833 \rfloor = 7$ 整除,$100$ 可以被 $\lfloor \sqrt{100} \rfloor = \lfloor 10 \rfloor = 10$ 整除。另一方面,$5$ 和 $40$ 不是奢侈数,因为 $5$ 不能被 $\lfloor \sqrt{5} \rfloor = \lfloor 2.2361 \rfloor = 2$ 整除,$40$ 不能被 $\lfloor \sqrt{40} \rfloor = \lfloor 6.3246 \rfloor = 6$ 整除。

作为Ela的朋友,你想和她一起参与这些健身活动,陪伴她(当然,也要一起享受乐趣)。在 $l$ 天和 $r$ 天之间,你想知道她改变了多少次活动。

**输入输出格式**

**输入格式**

每个测试包含多个测试案例。第一行包含测试案例的数量 $t$($1 \le t \le 10\,000$)。接下来是测试案例的描述。

每个测试案例只有一行,包含两个整数 $l$ 和 $r$($1 \le l \le r \le 10^{18}$)——你想知道Ela改变运动的区间。

**输出格式**

对于每个测试案例,输出一个整数,表示答案。

**输入输出样例**

**输入样例 #1**
```
5
8 19
8 20
119 121
1 100000000000000000
1234567891011 1000000000000000000
```
**输出样例 #1**
```
5
6
2
948683296
2996666667
```

**说明**

在第一个测试案例中,范围 $[8, 19]$ 内的5个奢侈数是:$8, 9, 12, 15, 16$。**题意翻译** 定义“奢侈数”为满足 $\lfloor \sqrt{x} \rfloor$ 是 $x$ 的因数的 $x$ 。求 $l$ 到 $r$ 之间有多少个“奢侈数”。(闭区间) **题目描述** Ela在DTL工作期间非常注重她的身心健康。她开始练习各种运动,比如射箭、瑜伽和足球。自从她开始参与体育活动以来,在那些她认为是“奢侈”的日子里,她会尝试一项新的运动。她从开始这些活动的日子开始计数,开始的那天被标记为第1天。一个“奢侈”日是指当天的编号是一个奢侈数。 一个整数 $x$ 被称为奢侈数,如果它可以被 ${\lfloor \sqrt{x} \rfloor}$ 整除。 这里 $\lfloor r \rfloor$ 表示实数 $r$ 的“下取整”。换句话说,它是小于或等于 $r$ 的最大整数。 例如:$8$、$56$、$100$ 都是奢侈数,因为 $8$ 可以被 $\lfloor \sqrt{8} \rfloor = \lfloor 2.8284 \rfloor = 2$ 整除,$56$ 可以被 $\lfloor \sqrt{56} \rfloor = \lfloor 7.4833 \rfloor = 7$ 整除,$100$ 可以被 $\lfloor \sqrt{100} \rfloor = \lfloor 10 \rfloor = 10$ 整除。另一方面,$5$ 和 $40$ 不是奢侈数,因为 $5$ 不能被 $\lfloor \sqrt{5} \rfloor = \lfloor 2.2361 \rfloor = 2$ 整除,$40$ 不能被 $\lfloor \sqrt{40} \rfloor = \lfloor 6.3246 \rfloor = 6$ 整除。 作为Ela的朋友,你想和她一起参与这些健身活动,陪伴她(当然,也要一起享受乐趣)。在 $l$ 天和 $r$ 天之间,你想知道她改变了多少次活动。 **输入输出格式** **输入格式** 每个测试包含多个测试案例。第一行包含测试案例的数量 $t$($1 \le t \le 10\,000$)。接下来是测试案例的描述。 每个测试案例只有一行,包含两个整数 $l$ 和 $r$($1 \le l \le r \le 10^{18}$)——你想知道Ela改变运动的区间。 **输出格式** 对于每个测试案例,输出一个整数,表示答案。 **输入输出样例** **输入样例 #1** ``` 5 8 19 8 20 119 121 1 100000000000000000 1234567891011 1000000000000000000 ``` **输出样例 #1** ``` 5 6 2 948683296 2996666667 ``` **说明** 在第一个测试案例中,范围 $[8, 19]$ 内的5个奢侈数是:$8, 9, 12, 15, 16$。

加入题单

算法标签: