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);
    }

}

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。