题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
http://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int year=sc.nextInt(); System.out.println(func(year)); } public static int func(int n){ if(n<=2){ return 1; } else{ return func(n-1)+func(n-2); } } }