public class Temp {
public static void main(String[] args) {
System.out.println(recursion(1, 100));
System.out.println(recursion(4, 5));
System.out.println(recursion(99, 100));
System.out.println(recursion(100, 100));
}
public static int recursion(int m, int n) {
int number = 0;
if (m == 1) {
number = ((2 * n) - 1);
} else {
number = 2 * recursion(m - 1, n - 1);
}
return number;
}
}
当我运行这段代码时,最后两个测试返回 0,我知道它们应该是大数字,这是为什么呢?我怎样才能弄清楚最后两个的价值?