递归函数 初学者!谢谢 了
# include<stdio.h>long Ack(int,int);
int main()
{
unsigned int m,n;
printf("plase Input:m,n");
scanf("%d %d",&m,&n);
printf("%ld",Ack(m,n));
getch ();
}
long Ack(int x,int y)
{
if (x==0) return(y+1);
if (y==0) return(Ack(x-1,1));
else
return(Ack(x-1,Ack(x,y-1)));
}
已知m>=0,n>=0 Ack(m,n)定义为
Ack(0,n)=n+1
Ack(m,0)=Ack(m-1,1)
Ack(m,n)=Ack(m-1,Ack(m,n-1)),