luogu#P10580. [蓝桥杯 2024 国 A] gcd 与 lcm
[蓝桥杯 2024 国 A] gcd 与 lcm
Problem Description
Given two numbers , find how many different sequences of length have the greatest common divisor of all elements equal to and the least common multiple equal to .
Two sequences and are considered different if there exists at least one position such that .
Since the answer may be very large, output the result modulo .
Input Format
The first line contains an integer , the number of queries.
The next lines each contain three integers , representing one query. Adjacent integers are separated by a single space. For each query, it is guaranteed that there exists at least one sequence satisfying the conditions.
Output Format
Output lines. Each line contains one integer, the answer for each query in order.
3
3 6 2
12 144 3
233 251640 10
2
72
905954656
Hint
For of the test cases, .
For of the test cases, .
For all test cases, , , .
Translated by ChatGPT 5