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

31126번 - Numeral systems 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB272233.333%

문제

Khodislav has learned that apart from the decimal numeral system, there exist other systems, such as the hexadecimal system. He is curious about the connection of the values of the same notation in these two systems. For instance, can a sequence of $K$ digits have its hexadecimal value divisible by its decimal value? Will anything change if we subtract a specified number $D$ from the decimal value of this notation?

A notation is a sequence of digits. Digits from 0 through 9 can be used in a notation: they belong both to the decimal and to the hexadecimal systems. A notation of a number cannot begin with the digit 0. The decimal value of a notation is the number resulting from interpreting the notation as a decimal number. The hexadecimal value of a notation is the number resulting from interpreting the notation as a hexadecimal number.

입력

The first line contains an integer $T$ --- the number of tests in the file (1ドル \le T \le 100$). It is followed by $T$ tests, one per line.

For each test, two integers are provided: $K$ --- the number of digits in the notation and $D$ --- the number to be subtracted from the decimal value (2ドル \le K \le 15,ドル 0ドル \le D \le 10^6$).

출력

For each test, find all required notations. Notations are sequences of $K$ digits without leading zeroes, with the value of $X$ in the decimal system and the value of $Y$ in the hexadecimal system, for which $X > D$ and $Y$ is divisible by $(X - D)$ without remainder.

The answers to each test are printed in a single line. First, print the number of the found notations, followed by all found notations in the ascending order, separated by spaces.

제한

예제 입력 1

4
5 6
2 0
2 5
2 21

예제 출력 1

3 12510 24990 37950
0
2 16 22
4 22 24 34 96

노트

In the first test, the notation 37950 means $X = 37950$ in the decimal system and $Y = 227664$ in the hexadecimal system. We can see that $Y = 227664$ is divisible by $X-D = 37944$ without remainder. Identically, for the notation 24990, $Y = 149904$ is divisible by $X-D = 24984,ドル and for the notation 12510, $Y = 75024$ is divisible by $X-D = 12504$.

출처

Contest > Open Cup > 2021/2022 Season > Stage 5: Grand Prix of Siberia 4번

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

출처

대학교 대회

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

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