摘要:
public int FibonacciSum(int aVal) { int sum = 0; if (aVal == 0) { return 0; } if (aVal == 1) { return sum = 1; } else if (aVal == 2) { return sum = 2; } else { int[] Fibo = new int[aVal]; for (int i = 0; i < aVal; i++) { Fibo[0] = 1; Fibo[1] = 1; for (int j = 3; j <= aVal; j++) { Fibo[j - 1] = 阅读全文
摘要:
public static int Fibonacci(int aVal) { if (aVal == 0) { return 0; } if (aVal <= 2) { return 1; } else return Fibonacci(aVal - 1) + Fibonacci(aVal - 2); } 阅读全文