#C2510. Self-Dividing Numbers
Self-Dividing Numbers
Self-Dividing Numbers
A self-dividing number is a number that is divisible by every one of its digits. For example, 128
is a self-dividing number since 128 % 1 == 0
, 128 % 2 == 0
, and 128 % 8 == 0
. Note that numbers containing the digit zero are not considered self-dividing.
You are given two integers, L and R, representing the lower and upper bound of a range, respectively. Your task is to output all self-dividing numbers in the range \([L, R]\) (inclusive) separated by a single space.
Note: The bounds and the self-dividing numbers satisfy \(1 \leq L \leq R \leq 10^4\).
inputFormat
The input consists of a single line containing two space-separated integers L and R representing the lower and upper bound, respectively.
outputFormat
Output a single line with all self-dividing numbers in the range \([L, R]\) separated by a single space. If there are no self-dividing numbers in the range, output an empty line.
## sample1 22
1 2 3 4 5 6 7 8 9 11 12 15 22