CF1712E1.LCM Sum (easy version)

提高+/省选-

通过率:0%

时间限制:3.50s

内存限制:512MB

AC君温馨提醒

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

题目描述

We are sum for we are many

Some Number

This version of the problem differs from the next one only in the constraint on tt. You can make hacks only if both versions of the problem are solved.

You are given two positive integers ll and rr.

Count the number of distinct triplets of integers (i,j,k)(i, j, k) such that l≤i<j<k≤rl \le i \lt j \lt k \le r and lcm⁡(i,j,k)≥i+j+k\operatorname{lcm}(i,j,k) \ge i + j + k.

Here lcm⁡(i,j,k)\operatorname{lcm}(i, j, k) denotes the least common multiple (LCM) of integers ii, jj, and kk.

我们求和,因为我们众多

某个数

本题版本与下一题版本的唯一区别在于对 tt 的约束条件。仅当两个版本的问题均被解决时,才允许进行 hack。

给定两个正整数 ll 和 rr。

请计算满足 l≤i<j<k≤rl \le i \lt j \lt k \le r 且 lcm⁡(i,j,k)≥i+j+k\operatorname{lcm}(i,j,k) \ge i + j + k 的互不相同的整数三元组 (i,j,k)(i, j, k) 的个数。

其中,lcm⁡(i,j,k)\operatorname{lcm}(i, j, k) 表示整数 ii、jj 和 kk 的最小公倍数(LCM)。

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤5\bf{1 \le t \le 5}). Description of the test cases follows.

The only line for each test case contains two integers ll and rr (1≤l≤r≤2⋅1051 \le l \le r \le 2 \cdot 10^5, l+2≤rl + 2 \le r).

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤5\bf{1 \le t \le 5})。随后是测试用例的描述。

每个测试用例仅有一行,包含两个整数 ll 和 rr(1≤l≤r≤2⋅1051 \le l \le r \le 2 \cdot 10^5,且 l+2≤rl + 2 \le r)。

输出格式

For each test case print one integer — the number of suitable triplets.

对于每个测试用例,输出一个整数——符合条件的三元组的数量。

输入输出样例

  • 输入#1

    5
    1 4
    3 5
    8 86
    68 86
    6 86868

    输出#1

    3
    1
    78975
    969
    109229059713337

说明/提示

In the first test case, there are 33 suitable triplets:

  • (1,2,3)(1,2,3),
  • (1,3,4)(1,3,4),
  • (2,3,4)(2,3,4).

In the second test case, there is 11 suitable triplet:

  • (3,4,5)(3,4,5).

在第一个测试用例中,有 33 个合适的三元组:

  • (1,2,3)(1,2,3),
  • (1,3,4)(1,3,4),
  • (2,3,4)(2,3,4)。

在第二个测试用例中,有 11 个合适的三元组:

  • (3,4,5)(3,4,5)。

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

首页