#C10804. Sum of Cubed Digits

    ID: 40050 Type: Default 1000ms 256MiB

Sum of Cubed Digits

Sum of Cubed Digits

Given an integer \( n \), compute a list where each element is the sum of the cubes of the digits of the numbers from 1 to \( n \). In mathematical terms, for each integer \( i \) (with \( 1 \leq i \leq n \)), you are to compute:

\[ S(i) = \sum_{d \in D(i)} d^3, \] where \( D(i) \) is the set of digits of \( i \). If \( n \leq 0 \), the output should be empty.

For example, if \( n = 5 \), then the output should be: 1, 8, 27, 64, 125.

inputFormat

A single integer ( n ) is provided via standard input.

outputFormat

Output the computed sums of the cubes of digits for numbers from 1 to ( n ) separated by a single space. If ( n \leq 0 ), output nothing.## sample

5
1 8 27 64 125