标签:pre include out problem div http == style man
阿克曼(Ackmann)函数A(m,n)中,m,n定义域是非负整数(m<=3,n<=10),函数值定义为:
akm(m,n) = n+1; (m=0时)
akm(m,n) = akm(m-1,1); (m>0,n=0时)
akm(m,n) = akm(m-1,akm(m, n-1)); (m,n>0时)
输入m和n。
函数值。
2 3
9
#include <iostream> #include<stdio.h> using namespace std; int akm(int m,int n){ if(m==0) return n+1; if(m>0&&n==0)return akm(m-1,1); return akm(m-1,akm(m, n-1)); } int main(){ int m,n; cin>>m>>n; cout<<akm(m,n); }
标签:pre include out problem div http == style man
原文地址:http://www.cnblogs.com/EdSheeran/p/7327048.html