[SOLUTION] Hope you get it solution codechef 2021 – Spider AlgoCup Codechef

Hope you get it solution codechef 2021

Hope you get it solution codechef 2021

Chef created a new dish and he is willing to give the recipe for the same. The ingredients for the recipe are product of numbers in a pair. A pair consists of two integers say X,YX,Y then the ingredient is XYX∗Y and XYX≠Y. After this chef mixes all the ingredients to make the dish.

Here mixing the ingredients means summation of all ingredients present in the dish. Also the dish will be best if it made from all possible Valid pairsValid pairs from a given range L to RL to R including LL and RR.

As chef is now making the dish , he asked you to calculate the value of summation till dish is ready to be served. Since the summation can be large, output the SUM Modulo 1000000007 (109+7109+7).

Input: Hope you get it solution codechef 2021

  • First line will contain TT, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, two integers L,RL,R.

Output: Hope you get it solution codechef 2021

For each testcase, output in a single line SUM modulo 1000000007.

Constraints Hope you get it solution codechef 2021

  • 1T1000001≤T≤100000
  • 1LR1091≤L≤R≤109

Sample Input: Hope you get it solution codechef 2021

1
3 7

Sample Output: Hope you get it solution codechef 2021

490

Hope you get it solution codechef 2021

EXPLANATION:

34+35+36+37+45+46+47+56+57+67=2453∗4+3∗5+3∗6+3∗7+4∗5+4∗6+4∗7+5∗6+5∗7+6∗7=245 , SUM =2245SUM =2∗245(twice for reverse pairs)

Program Code :

We don not promote cheating in any sense, so try you best and if your want solution you can check it after a day.

Thank You 

ALL THE BEST.

[SOLUTION] Hope you get it solution codechef 2021 - Spider AlgoCup Codechef

Also read : Flower Sequence solution codechef 2021

Leave a Comment