标签:
/**
* Created by Administrator on 2015/10/10.
*/
/*
* 1,1,2,3,5,8,13,21,....
* 求解第30位数是多少
* */
public class demo1 {
public static int compute(int n){
if(n==1||n==2){
return 1;
}else{
return compute(n-1)+compute(n-2);
}
}
//测试
public static void main(String[] args){
System.out.print(compute(30));
}
}
标签:
原文地址:http://www.cnblogs.com/hujingwei/p/4868026.html