1737B.md (2364B)
1 Source: https://codeforces.com/problemset/problem/1737/B 2 3 B. Ela's Fitness and the Luxury Number 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 | | | 22 | --- | --- | 23 | | 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. | 24 25 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. 26 27 An integer $x$ is called a luxurious number if it is divisible by ${\lfloor \sqrt{x} \rfloor}$. 28 29 Here $\lfloor r \rfloor$ denotes the "floor" of a real number $r$. In other words, it's the largest integer not greater than $r$. 30 31 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$. 32 33 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. 34 35 Input 36 37 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. 38 39 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. 40 41 Output 42 43 For each test case, output an integer that denotes the answer. 44 45 Example 46 47 Input 48 49 ``` 50 5 51 52 8 19 53 54 8 20 55 56 119 121 57 58 1 100000000000000000 59 60 1234567891011 1000000000000000000 61 ``` 62 63 Output 64 65 ``` 66 5 67 6 68 2 69 948683296 70 2996666667 71 ``` 72 73 Note 74 75 In the first test case, $5$ luxury numbers in range $[8, 19]$ are: $8, 9, 12, 15, 16$.