Narcissistic Number


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
C, C++, Python3

A narcissistic number is an \(n\)-digit decimal number, in which the power \(n\) sum of all digits equals that number.

For example, 153 is a 3-digit narcissistic number, and the power \(3\) sum of all its digits equals itself: \(1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153\).

Given input number \(A, B\), output in ascending order all narcissistic numbers in that range (\(A \le m \le B\)).

Input Specification

The first line will contain a 2 integers \(A, B\) (\(10 < A,B < 100000\)).

Output Specification

Output a single integer per line, all the narcissistic numbers within \([A, B]\) in ascending order.

Sample Input

101 999

Sample Output

153 370 371 407

Comments

There are no comments at the moment.