#P13582. [NWRRC 2023] Based Zeros
[NWRRC 2023] Based Zeros
题目描述
Barbara has always known how to represent integers in the decimal numeral system (base ten), using digits . Recently she has learned that for any integer base , she can also represent integers in base , using symbols with values from to , inclusive, as digits.
Barbara's favorite digit is . Luckily, it looks the same in all bases.
Today Barbara is playing with a positive integer . Now she wonders: in what bases does the representation of contain the biggest number of zeros? Help her to find all such bases.
输入格式
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The only line of each test case contains a single integer ().
输出格式
For each test case, in the first line, print two integers and , denoting the maximum number of zeros the representation of can have in any integer base, and the number of such bases, respectively.
In the second line, print integers , denoting all such bases in increasing order ().
3
11
1007
239
1 3
2 3 11
2 2
3 10
1 4
2 6 15 239
提示
Here are the representations with the maximum number of zeros for the example test cases:
- $11 = \mathtt{1011}_2 = \mathtt{102}_3 = \mathtt{10}_{11}$ (one zero);
- (two zeros);
- $239 = \mathtt{11101111}_2 = \mathtt{1035}_6 = \mathtt{10E}_{15} = \mathtt{10}_{239}$ (one zero).
In the representation, stands for a digit with the value of .