public class Test01 {
public static void main(String[] args) {
while (true) {
System.out.println("请输入你想知道第几月兔子的对数:");
String str = new Scanner(System.in).nextLine();
int num = Integer.parseInt(str);
System.out.println("第"+num+"个月的兔子总对数为:"+method(num));
}
}
public static BigInteger method(int num) {
BigInteger[] arr = new BigInteger[num];
if (num == 1||num == 2) {
return new BigInteger("1");
}else {
return method(num-1).add(method(num-2));
}