static void Main(string[] args)
        {
            Console.WriteLine(foo(30));
            Console.ReadKey();
           
        }
        public static int foo(int i)
        {
            if (i <= 0)
            {
                return 0;
            }
            else if (i >= 0 && i <= 2)
            {
                return 1;
            }
            else
                return foo(i - 1) + foo(i - 2);
        }

posted on 2016-11-21 17:01  菜鸟Only  阅读(280)  评论(0编辑  收藏  举报