计蒜客 简单斐波那契 Java实现计蒜客 简单斐波那契 Java实现

import java.util.Scanner;

public class Main {
    public static int F(int a) {
        if(a==0) 
            return 0;
        if(a==1) 
            return 1;
       return F(a-1)+F(a-2);
    }
    public static void main(String[] args) {
        Scanner sc=new  Scanner(System.in);
        int N=sc.nextInt();
            System.out.println(F(N));
    }

}

//欢迎指正  大佬轻喷

相关文章:

  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2021-12-30
  • 2021-06-29
  • 2021-09-03
猜你喜欢
  • 2022-01-30
  • 2022-02-15
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
相关资源
相似解决方案