GUPTA MECHANICAL

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

Wednesday, 22 June 2022

[Solution] Jogging CodeChef Solution | CodeChef Problem Solution 2022


Alice jogs everyday to keep herself fit and active. She noticed that she burns X calories when jogging the first kilometer, and for K>1, jogging the Kth kilometer burns calories equivalent to the total number of calories burned while jogging the first K−1 kilometers.

What is the total number of calories that Alice burns after jogging for N kilometers? The answer can be very large, so report it modulo 109+7 (1000000007).

Input Format

  • The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
Solution Click Below:-  CLICK HERE


  • The first and only line of each test case contains two space-separated integers N and X, as described in the problem statement.

Output Format

For each test case, output on a new line the total number of calories that Alice burns after jogging for N kilometers, modulo 109+7.

Constraints

  • 1≤T≤105
  • 1≤N≤106

No comments:

Post a Comment