日期:2014-05-20 浏览次数:20792 次
public class Test { public static void main(String args[]) { int x1 = 1; int sum = 0; int n = 7; for (int i = 1; i <= n; i++) { x1 = func(i); sum = sum + x1; } System.out.println("sum=" + sum); } public static int func(int x) { if (x > 2) return (func(x - 1) + func(x - 2)); else return 1; } }
------解决方案--------------------
偶只会玩兔子,不会数兔子,LZ把题目也贴出来吧^_^
------解决方案--------------------
关注一下,我先睡觉了.