GUPTA MECHANICAL

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

Friday, 26 August 2022

[Solution] Sherlock and Watson Gym Secrets Kick Start Session Solution - Kick Start 2022



Watson and Sherlock are gym buddies.

Their gym trainer has given them three numbers, AB, and N, and has asked Watson and Sherlock to pick two different positive integers i and j, where i and j are both less than or equal to N. Watson is expected to eat exactly iA sprouts every day, and Sherlock is expected to eat exactly jB sprouts every day.

Watson and Sherlock have noticed that if the total number of sprouts eaten by them on a given day is divisible by a certain integer K, then they get along well that day.

So, Watson and Sherlock need your help to determine how many such pairs of (i,j) exist, where ij and they get along well that day. As the number of pairs can be really high, please output it modulo 109+7(1000000007).

Input

The first line of the input gives the number of test cases, TT test cases follow. Each test case consists of

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

 one line with 4 integers ABN and K, as described above.

Output

For each test case, output one line containing Case #xy, where x is the test case number (starting from 1) and y is the required answer.

Limits

Time limit: 60 seconds.
Memory limit: 1 GB.
1T100.
0A106.
0B106.

Test Set 1

1K104.
1N103.

Test Set 2

1K105.
1N1018.

No comments:

Post a Comment