-->
当前位置:首页 > 题库

PROGRAMMING:Using array to calculate Fibonacci sequence

Luz5年前 (2021-05-10)题库429
This problem requires the preparation of procedures, the use of arrays to calculate Fibonacci (Fibonacci) sequence of the first $$n $$items, output 5 per line, the title to ensure that the calculation results in the long integer range. Fibonacci sequence is a sequence which satisfies that any number is the sum of the first two terms (the first two terms are defined as 1), for example: 1, 1, 2, 3, 5, 8, 13.
###Input format:
Input gives an integer $$n $$($$1 / Le n / Le 46 $$) in one line.
###Output format:
Output the first $$n $$Fibonacci numbers, each number occupies 11 bits, and each line outputs 5. If the output number of the last line is less than 5, you also need to wrap the line.
If the input $$n $$is not in the valid range, output "invalid.".
###Input sample 1:
```in
seven
```
###Output sample 1:
```out
1 1 2 3 5
8 13
```
###Input sample 2:
```in
0
```
###Output sample 2:
```out
Invalid.
```






answer:If there is no answer, please comment