#include <stdio.h> int count = 0; int Ackerman(int m, int n){ count++; if(m == 0) return n + 1; else if(n == 0) return Ackerman(m - 1, 1); else return Ackerman(m - 1, Ackerman(m, n - 1)); } int main() { printf("Number:%d\n", Ackerman(2,2)); printf("Count:%d\n", count); return 0; }
參考資料:
http://zh.wikipedia.org/wiki/%E9%98%BF%E5%85%8B%E6%9B%BC%E5%87%BD%E6%95%B8
http://blog.sina.com.cn/s/blog_4765a1560100bpqn.html