Choose Fibonacci numbers
Problem
Given an array of numbers. It is necessary to write to another array, all the Fibonacci numbers of the original array. If there are no Fibonacci numbers in the source array, the program should print the number 0.
Input
The first line contains the size of the
N
array. The second line contains space-separated
N
numbers – array elements (non-negative integers not exceeding 1000). It is guaranteed that
0 < N ≤ 10000
.
Imprint
The program should display all the elements of the constructed array in one line, separating them with spaces. If there were no suitable elements in the array, the program should print the number 0.
Examples
# |
Input |
Output |
1 |
6
4 14 5 8 12 13
| 5 8 13 |
Запрещенные операторы: sort
; min
; max
; reverse
; count
; sum
; index