首页 > 试题广场 >

递归算法x(8)需要调用()次函数x(intn)classp

[单选题]

递归算法x(8)需要调用( )次函数x(int n)

class program

 {

     static void Main(string[] args)

     {

         int i;

         i = x(8);

     }

     static int x(int n)

     {

         if (n <= 3)

             return 1;

         else

             return x(n - 2) + x(n - 4) + 1;

     }

 }

  • 9
  • 12
  • 18
  • 24
发表于 2021-07-09 18:30:13 回复(0)