公式法
public class Main{
public static void main(String[] args) {
int s = fib(8);
System.out.println(s);
}
public static int fib(int n)
{
double phi = (1+Math.sqrt(5))/2;
return (int) Math.round(Math.pow(phi,n)/Math.sqrt(5));
}
}