题目大家都知道
直接上代码
package dig; import java.util.Scanner; public class shangtaij { int zhongshu=0; void loti(int shenyu){ if(shenyu>1){ loti(shenyu-1); loti(shenyu-2); }else { ++zhongshu; return; } } public static void main(String[] args) { Scanner in=new Scanner(System.in); shangtaij go=new shangtaij(); go.loti(in.nextInt()); System.out.println(go.zhongshu); } }