首页 > 用户发贴区 > 编程问题提问区 > 求高手帮忙解决一个C程序的题目!急
2008
10-16

求高手帮忙解决一个C程序的题目!急


Double recursion function


 


Ackermann Function is defined as


 


ack(0,n) = n + 1


ack(m,0) = ack( m-1, 1)


ack(m,n) = ack( m – 1, ack( m, n – 1 ))


 


 


For example


ack( 1, 1 )


= ack ( 0, ack ( 1, 0 ) )


= ack ( 0 , ack( 0, 1 ) )


= ack ( 0, 2 )


= 3


 


Try to work out ack( 1 , 2 ) and ack ( 1, 3 ) by hand.


 


Write a program that will accept two parameters and display the value of the corresponding Ackermann function. For example:


 


$ ack 1 1


 


The Ackermann value of ack(1,1) is 3


 


Using your program, try to find out the values of ack(2,3), ack(3,2) and ack(4,2).


WARNING!!!! It may not be as easy as it looks


 


求高手帮忙解决一个C程序的题目!急》有 1 条评论

  1. Perfect 说:

    是不是最大是ack(4,n)?

留下一个回复