-
-
Describe
-
The
-
Fibonacci sequence refers to the series: the first and second numbers of the series are 1, followed by each number equal to the sum of the preceding 2 numbers.
Give a positive integer a, which requires the number of a in the Fresnel sequence.
-
-
Input
-
-
Line 1th is the number of groups of test data n, followed by n-line input. 1 rows per set of test data, including a positive integer a (1 <= a <=)
-
-
Output
-
-
the output has n rows, and each line of output corresponds to one input. The output should be a positive integer, the size of number A in the Fibonacci sequence
-
-
Sample input
-
-
452191
-
-
Sample output
-
5141811
I heard that this series is a formula, but the slag will not, only slowly recursion
Code
#include<cstdio>#include<iostream>UsingNamespace Std;int RE[23]={0};IntF(int x){int IJK, l; re[1]=1; re[2]=1;For(I=3; I<=23; I+ +) re[I]=re[I-2]+re[I-1];Return0;}//Building TableIntMain(){F(1);int a[25]={0},N(0), IJK; Cin>>n;for (I=0;i<n;i++) Cin>>a[i]; For (I=0;i<n;i++) cout< <re[a[i]]<<endl return 0;}
Recursive-Fibonacci sequence