#P1792E. Divisors and Table
Divisors and Table
Description
You are given an multiplication table and a positive integer . A multiplication table is a table with rows and columns numbered from to , where .
For each divisor of , check: does occur in the table at least once, and if it does, what is the minimum row that contains .
The first line contains a single integer () — the number of test cases.
The first and only line of each test case contains three integers , and (; ) — the size of the multiplication table and the integer represented as .
For each test case, let be all divisors of sorted in the increasing order. And let be an array of answers, where is equal to the minimum row index where divisor occurs, or , if there is no such row.
Since array may be large, first, print an integer — the number of divisors of that are present in the table. Next, print a single value , where denotes the bitwise XOR operation.
Input
The first line contains a single integer () — the number of test cases.
The first and only line of each test case contains three integers , and (; ) — the size of the multiplication table and the integer represented as .
Output
For each test case, let be all divisors of sorted in the increasing order. And let be an array of answers, where is equal to the minimum row index where divisor occurs, or , if there is no such row.
Since array may be large, first, print an integer — the number of divisors of that are present in the table. Next, print a single value , where denotes the bitwise XOR operation.
Note
In the first test case, and has divisors . The multiplication table looks like that:
1 | 2 | 3 | |
1 | 1 | 2 | 3 |
2 | 2 | 4 | 6 |
3 | 3 | 6 | 9 |
For each divisor of that is present in the table, the position with minimum row index is marked. So the array of answers is equal to . There are only non-zero values, and xor of is equal to .
In the second test case, and has divisors . All divisors except and are present in the table. Array . There are non-zero values, and xor of is equal to .
In the third test case, and has divisors . The table with marked divisors is shown below:
1 | 2 | 3 | 4 | 5 | 6 | |
1 | 1 | 2 | 3 | 4 | 5 | 6 |
2 | 2 | 4 | 6 | 8 | 10 | 12 |
3 | 3 | 6 | 9 | 12 | 15 | 18 |
4 | 4 | 8 | 12 | 16 | 20 | 24 |
5 | 5 | 10 | 15 | 20 | 25 | 30 |
6 | 6 | 12 | 18 | 24 | 30 | 36 |
Array . There are non-zero values, and xor of is equal to .