简单斐波那契(java)
import java.util.*;
class Main{
static final int N = 46;
static int[] q = new int [N];
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
fib(n);
}
private static void fib(int n){
q[0] = 0;
q[1] = 1;
q[2] = 1;
for(int i = 3; i<n ; i++){
q[i] = q[i-1]+q[i-2];
}
for(int i = 0; i<n; i++){
System.out.print(q[i]+" ");
}
}
}