# Eddy's research II

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2706    Accepted Submission(s): 985

Problem Description

As is known, Ackermann function plays an important role in the sphere of theoretical computer science. However, in the other hand, the dramatic fast increasing pace of the function caused the value of Ackermann function hard to calcuate. Ackermann function can be defined recursively as follows:

Now Eddy Gives you two numbers: m and n, your task is to compute the value of A(m,n) .This is so easy problem,If you slove this problem,you will receive a prize(Eddy will invite you to hdu restaurant to have supper).

Input

Each line of the input will have two integers, namely m, n, where 0 < m < =3. Note that when m<3, n can be any integer less than 1000000, while m=3, the value of n is restricted within 24. Input is terminated by end of file.

Output

For each value of m,n, print out the value of A(m,n).

Sample Input

1 3

2 4

Sample Output

5

11

``` 1 /*@coder龚细军*/
2 #include<stdio.h>
3 int Ackermann(int m,int n)
4 {
5          if(m==0) return n+1;
6     else if(m==1) return n+2;
7     else if(m==2) return 2*n+3;
8     else if(m==3) return (1<<n+3)-3;
9 }
10 int main()
11 {
12     int n,m;
13     while(~scanf("%d%d",&m,&n))
14     {
15         printf("%d\n",Ackermann(m,n));
16     }
17     return 0;
18 }```

0 条评论

• ### HDUOJ------2492Ping pong

Ping pong Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ...

• ### hdu 2473 Junk-Mail Filter (并查集之点的删除)

Junk-Mail Filter Time Limit: 15000/8000 MS (Java/Others)    Memory Limit: 32768/...

• ### hdu----（5045）Contest（数位dp）

Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (J...

• ### 现代设计方法和机电产品的发展 (cs)

中文摘要：本文简要介绍了机电产品的开发，以及如何将设计思维、并行工程和敏捷论等技术集成在一起来解决这一开发问题。设计思维在早期是为了更好地发掘创造力，而并行工程...

• ### 2018 TCO Algorithm-Round 1B 600-points题解报告

Consider the set of integers between 1 and n, inclusive, and two positive intege...

• ### 学会忘记: 联邦学习法中的用户记忆消除（CS LG）

学会忘记:联邦学习中的用户级记忆消除是一种分散性的机器学习技术，在研究领域和现实市场都引起了广泛的关注。 然而，目前保护隐私的联邦学习方案只是为用户提供了一个安...

• ### POJ1286 Necklace of Beads(Polya定理)

Beads of red, blue or green colors are connected together into a circular neckla...

• ### Batch Normalization论文翻译——中英文对照

Batch Normalization: Accelerating Deep Network Training by Reducing Internal Cov...

• ### CodeForces 668B Little Artem and Dance

B. Little Artem and Dance time limit per test 2 second memory limit per test...