Logo
(追記) (追記ここまで)

30597번 - Based Zeros 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB45181336.111%

문제

Barbara has always known how to represent integers in the decimal numeral system (base ten), using digits 0,ドル 1, 2, \ldots, 9$. Recently she has learned that for any integer base $b \ge 2,ドル she can also represent integers in base $b,ドル using symbols with values from 0ドル$ to $b-1,ドル inclusive, as digits.

Barbara's favorite digit is 0ドル$. Luckily, it looks the same in all bases.

Today Barbara is playing with a positive integer $n$. Now she wonders: in what bases does the representation of $n$ 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 $t$ (1ドル \le t \le 1000$). The description of the test cases follows.

The only line of each test case contains a single integer $n$ (2ドル \le n \le 10^{18}$).

출력

For each test case, in the first line, print two integers $k$ and $m,ドル denoting the maximum number of zeros the representation of $n$ can have in any integer base, and the number of such bases, respectively.

In the second line, print $m$ integers $b_1, b_2, \ldots, b_m,ドル denoting all such bases in increasing order (2ドル \le b_1 < b_2 < \cdots < b_m \le n$).

제한

예제 입력 1

3
11
1007
239

예제 출력 1

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);
  • 1007ドル = \mathtt{1101022}_3 = \mathtt{1007}_{10}$ (two zeros);
  • 239ドル = \mathtt{11101111}_2 = \mathtt{1035}_6 = \mathtt{10E}_{15} = \mathtt{10}_{239}$ (one zero).

In the 239ドル = \mathtt{10E}_{15}$ representation, $\mathtt{E}$ stands for a digit with the value of 14ドル$.

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > ICPC 2023-2024 Northwestern Russia Regional Contest B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /