#P7360. 「JZOI-1」红包
「JZOI-1」红包
Description
The total amount of money in Xiaoxi’s red packet is defined as follows:
Consider all -tuples where every element is a positive integer and . The total amount is the product of the least common multiples of all these -tuples.
However, his uncle does not have that much money, so the result should be taken modulo .
Xiaoxi computed it in seconds, but he wants to verify whether it is correct, so he came to you (don’t ask why he doesn’t just open the red packet and check).
In other words, you only need to compute:
$$\prod_{i_1=1}^N\prod_{i_2=1}^N...\prod_{i_K=1}^N{\rm lcm}(i_1,i_2...i_K)\mod 998244353$$It is guaranteed that . Here, denotes the least common multiple of .
Input Format
This problem has multiple test cases.
The first line contains an integer , the number of test cases.
The next lines each contain two integers , representing one query.
Output Format
Output lines, each containing one integer, the answer modulo .
2
2 2
3 2
8
7776
Hint
For the first test case in the sample, the problem asks for ${\rm lcm}(1,1)\times {\rm lcm}(1,2)\times {\rm lcm}(2,1)\times {\rm lcm}(2,2)$.
Clearly, except for , all other results are , so the answer is .
| Data ID | |||
|---|---|---|---|
| 0 | |||
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 |
Problem setter: Do you really think there is that much money? Haha, it is all Zimbabwe dollars inside!
Translated by ChatGPT 5
京公网安备 11011102002149号