上一页 1 ··· 79 80 81 82 83
摘要: 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] = 阅读全文
posted @ 2012-03-21 16:55 沙耶 阅读(3114) 评论(0) 推荐(0) 编辑
摘要: public static int Fibonacci(int aVal) { if (aVal == 0) { return 0; } if (aVal <= 2) { return 1; } else return Fibonacci(aVal - 1) + Fibonacci(aVal - 2); } 阅读全文
posted @ 2012-03-21 16:54 沙耶 阅读(197) 评论(0) 推荐(0) 编辑
上一页 1 ··· 79 80 81 82 83