#C6332. Find Armstrong Numbers

    ID: 50081 Type: Default 1000ms 256MiB

Find Armstrong Numbers

Find Armstrong Numbers

Given a non-negative integer \(n\), your task is to find all Armstrong numbers in the range \(0\) to \(n\) (inclusive). An Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits. For instance, \(153\) is an Armstrong number because \(1^3 + 5^3 + 3^3 = 153\).

You are required to read the input from stdin and print all the Armstrong numbers on one line separated by a single space to stdout.

inputFormat

The input consists of a single integer (n) given via standard input.

outputFormat

Output all Armstrong numbers from (0) to (n) inclusive in ascending order, separated by a single space.## sample

1000
0 1 2 3 4 5 6 7 8 9 153 370 371 407