#C14981. Fibonacci Sequence Generator

    ID: 44690 Type: Default 1000ms 256MiB

Fibonacci Sequence Generator

Fibonacci Sequence Generator

Given a non-negative integer ( n ), generate the first ( n ) numbers of the Fibonacci sequence. The Fibonacci sequence is defined as follows: ( F(0)=0, F(1)=1 ), and for ( n \geq 2 ), ( F(n)=F(n-1) + F(n-2) ). If the input is invalid (i.e. not a non-negative integer), output the error message: "Input must be a non-negative integer".

inputFormat

The input consists of a single line containing an integer ( n ) where ( n \ge 0 ).

outputFormat

If ( n ) is a non-negative integer, output the first ( n ) Fibonacci numbers separated by a single space. If ( n = 0 ), output an empty line. If the input is invalid (non-integer or negative), output the error message: "Input must be a non-negative integer".## sample

10
0 1 1 2 3 5 8 13 21 34