Java 代码
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int a = 0;
int b = 1;
for (int i = 0; i < n; i ++)
{
System.out.print(a + " ");
int temp = a + b;
a = b;
b = temp;
}
}
}