package com.Summer_0419.cn;
/**
* @author Summer
* 一列数的规则如下: 1、1、2、3、5、8、13、21、34 .....
* 求第30位数是多少?
* 使用递归实现
*
*/
public class Test_Method08 {
public static void main(String[] args) {
int num = count(30);
System.out.println(num);
}
private static int count(int weishu) {
if (weishu==1||weishu==2) {
return 1;
}
return count(weishu-1)+count(weishu-2);
}
}
转载于:https://www.cnblogs.com/summerdata/p/10739129.html