[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, , , and , and has asked Watson and Sherlock to pick two different positive integers and , where and are both less than or equal to . Watson is expected to eat exactly sprouts every day, and Sherlock is expected to eat exactly 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 , then they get along well that day.
So, Watson and Sherlock need your help to determine how many such pairs of exist, where and they get along well that day. As the number of pairs can be really high, please output it modulo .
Input
The first line of the input gives the number of test cases, . test cases follow. Each test case consists of
one line with 4 integers , , and , as described above.
Output
For each test case, output one line containing Case #:
, where is the test case number (starting from 1) and is the required answer.
Limits
Time limit: 60 seconds.
Memory limit: 1 GB.
.
.
.
Test Set 1
.
.
Test Set 2
.
.
No comments:
Post a Comment