CF1737B.Ela's Fitness and the Luxury Number

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 11. A "Luxury" day is the day in which the number of this day is a luxurious number.

An integer xx is called a luxurious number if it is divisible by ⌊x⌋{\lfloor \sqrt{x} \rfloor}.

Here ⌊r⌋\lfloor r \rfloor denotes the "floor" of a real number rr. In other words, it's the largest integer not greater than rr.

For example: 88, 5656, 100100 are luxurious numbers, since 88 is divisible by ⌊8⌋=⌊2.8284⌋=2\lfloor \sqrt{8} \rfloor = \lfloor 2.8284 \rfloor = 2, 5656 is divisible ⌊56⌋=⌊7.4833⌋=7\lfloor \sqrt{56} \rfloor = \lfloor 7.4833 \rfloor = 7, and 100100 is divisible by ⌊100⌋=⌊10⌋=10\lfloor \sqrt{100} \rfloor = \lfloor 10 \rfloor = 10, respectively. On the other hand 55, 4040 are not, since 55 are not divisible by ⌊5⌋=⌊2.2361⌋=2\lfloor \sqrt{5} \rfloor = \lfloor 2.2361 \rfloor = 2, and 4040 are not divisible by ⌊40⌋=⌊6.3246⌋=6\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 ll and day rr, you want to know how many times she changes the activities.

在 DTL 工作期间,Ela 非常注重自己的身体与心理健康。她开始尝试多种体育运动,例如射箭(Archery)、瑜伽(Yoga)和足球(Football)。

自从开始参与这些体育活动以来,Ela 会在她认定为“奢华日”(Luxury day)的那些天更换所练习的新运动项目。她从开始参与这些活动起对天数进行计数,起始当天记为第 11 天。“奢华日”即该天的编号是一个“奢华数”(luxurious number)。

一个整数 xx 被称为奢华数,当且仅当它能被 ⌊x⌋\lfloor \sqrt{x} \rfloor 整除。

其中 ⌊r⌋\lfloor r \rfloor 表示实数 rr 的“下取整”(floor),即不超过 rr 的最大整数。

例如:88、5656、100100 均为奢华数,因为 88 可被 ⌊8⌋=⌊2.8284⌋=2\lfloor \sqrt{8} \rfloor = \lfloor 2.8284 \rfloor = 2 整除;5656 可被 ⌊56⌋=⌊7.4833⌋=7\lfloor \sqrt{56} \rfloor = \lfloor 7.4833 \rfloor = 7 整除;100100 可被 ⌊100⌋=⌊10⌋=10\lfloor \sqrt{100} \rfloor = \lfloor 10 \rfloor = 10 整除。而 55 和 4040 则不是奢华数,因为 55 不能被 ⌊5⌋=⌊2.2361⌋=2\lfloor \sqrt{5} \rfloor = \lfloor 2.2361 \rfloor = 2 整除,且 4040 不能被 ⌊40⌋=⌊6.3246⌋=6\lfloor \sqrt{40} \rfloor = \lfloor 6.3246 \rfloor = 6 整除。

作为 Ela 的朋友,你希望与她一同参与这些健身活动,陪伴她(当然也一起享受乐趣)。现在,请你计算在第 ll 天到第 rr 天(含端点)之间,她共更换了多少次运动项目。

输入格式

Each test contains multiple test cases. The first line has the number of test cases tt (1≤t≤10 0001 \le t \le 10\ 000). The description of the test cases follows.

The only line of each test case contains two integers ll and rr (1≤l≤r≤10181 \le l \le r \le 10^{18}) — the intervals at which you want to know how many times Ela changes her sports.

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤10 0001 \le t \le 10\ 000)。随后是各测试用例的描述。

每个测试用例仅有一行,包含两个整数 ll 和 rr(1≤l≤r≤10181 \le l \le r \le 10^{18})——表示你想知道 Ela 在该区间内更改运动项目的次数。

输出格式

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, 55 luxury numbers in range [8,19][8, 19] are: 8,9,12,15,168, 9, 12, 15, 16.

在第一个测试用例中,区间 [8,19][8, 19] 内的 55 个奢华数为:8,9,12,15,168, 9, 12, 15, 16。

输入解题思路,AI测评打分。不知道怎么写?

首页