#C12804. Fibonacci Sequence with Digit Sum

    ID: 42272 Type: Default 1000ms 256MiB

Fibonacci Sequence with Digit Sum

Fibonacci Sequence with Digit Sum

This problem requires you to generate the first n numbers of the Fibonacci sequence. For a given positive integer n, you need to compute the Fibonacci sequence and, in addition, print each number's position alongside the number itself and the sum of its digits. The output should first list, line by line, the index and corresponding Fibonacci number with its digit sum. Finally, print the entire Fibonacci sequence in a Python list-like format.

If n is less than or equal to 0, output an empty list.

The formula for the Fibonacci sequence is given by:

\( F(0)=0,\quad F(1)=1,\quad F(n)=F(n-1)+F(n-2) \text{ for } n\geq2. \)

inputFormat

The input will be read from standard input and consists of a single integer n which indicates the number of Fibonacci numbers to compute.

Input Format:

n

outputFormat

The output should be printed to standard output. For a positive n, you must:

  • Print n lines. Each line should contain the index, the Fibonacci number at that index, and the sum of its digits, formatted as:
index - number (sum of digits: sum)
  • After these lines, print the entire Fibonacci sequence in a Python list-like format.
  • If n is less than or equal to 0, simply output [].
## sample
0
[]