fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long akkerman(long m , long n)
  5. {
  6. if (m==0) return n+1;
  7. if (m>0 && n==0) return akkerman(m-1, 1);
  8. return akkerman(m-1, akkerman(m, n-1));
  9. }
  10. int main() {
  11. // your code goes here
  12. std::cout<<akkerman(0,0)<<std::endl;
  13. std::cout<<akkerman(2,1)<<std::endl;
  14. std::cout<<akkerman(2,3)<<std::endl;
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
1
5
9