动规
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int count = 0;
int[] num = new int[32];
num[1] = 1;
num[2] = 1;
for(int i = 3; i<=n; i++){
num[i] = num[i-1]+num[i-2];
}
System.out.print(num[n]);
}
}
递归也很神奇