GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Tuesday 16 August 2022

[Solution] LCM Sum (hard version) Codeforces Solution



E2. LCM Sum (hard version)
time limit per test
3.5 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

This version of the problem differs from the previous one only in the constraint on 

t. You can make hacks only if both versions of the problem are solved.

You are given two positive integers l and r.

Count the number of distinct triplets of integers (i,j,k) such that li<j<kr and lcm(i,j,k)i+j+k.

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

Here lcm(i,j,k) denotes the least common multiple (LCM) of integers ij, and k.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1t105). Description of the test cases follows.

The only line for each test case contains two integers l and r (1lr2105l+2r).

Output

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

No comments:

Post a Comment