Submit | All submissions | Best solutions | Back to list |
FUCT_FOR_FATNUM - Fat number |
A fat number is a number that the sum of its digits is equal with the multiple of its digits.
Example: 321 and 123 and 213 are fat number because 3 + 2 + 1 = 3 * 2 * 1.
Your mission is finding all fat number between a and b inclusive.
Input
The first line of the input consist of a single integer number t which determines the number of tests.
In each of next t lines there is two number a and b separated by a space.
Constraints
- 0 < t ≤ 1 000
- 0 ≤ a, b ≤ 10 000 000
Output
For each test case print out all fat number found inside the range which separated by a space.
Separate your answers with a new line character.
Example
Input: 2 8 15 2000 1 Output: 8 9 1 2 3 4 5 6 7 8 9 22 123 132 213 231 312 321 1124 1142 1214 1241 1412 1421
Added by: | khanhvh |
Date: | 2018-07-10 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | FPTU Can Tho |