题解 | #牛牛的Ackmann#
牛牛的Ackmann
https://www.nowcoder.com/practice/3a7a4c26420c4358a1a5cda3da2fa1c8
#include<stdio.h>/*上网查了一下,题目m,n参数给反了,函数内第二条应该是ackmann(m-1,1),函数也 给错了,都改完就好了,实在不行就加几条m==1,2,3,缩小下递归试试吧 long long x=0; int ackmann(long long m,long long n) { if(m==0) { return n+1; } if(m>0&&n==0) return ackmann(m-1,1); if(m>0&&n>0) return ackmann(m-1,ackmann(m,n-1)); return 0; } int main() { long long n; long long m; scanf("%lld %lld",&n,&m); printf("%lld",ackmann(m,n)); return 0; }