阿克曼(Ackermann)函数

Luogu
IDLGB2144
Time1000ms
Memory128MB
DifficultyP1
函数与递归
阿克曼(Ackermann)函数 $A(m,n)$ 中,$m, n$ 定义域是非负整数($m \le 3$,$n \le 10$),函数值定义为: $\mathit{A}(m,n)=n+1$;($m=0$ 时)。 $\mathit{A}(m,n)=\mathit{A}(m-1,1)$;($m>0$、$n=0$ 时)。 $\mathit{A}(m,n)=\mathit{A}(m-1,\mathit{A}(m,n-1))$;($m,n>0$ 时)。 ## Input $m$ 和 $n$。 ## Output 函数值。 [samples]
Samples
Input #1
2 3
Output #1
9
API Response (JSON)
{
  "problem": {
    "name": "阿克曼(Ackermann)函数",
    "description": {
      "content": "阿克曼(Ackermann)函数 $A(m,n)$ 中,$m, n$ 定义域是非负整数($m \\le 3$,$n \\le 10$),函数值定义为: $\\mathit{A}(m,n)=n+1$;($m=0$ 时)。 $\\mathit{A}(m,n)=\\mathit{A}(m-1,1)$;($m>0$、$n=0$ 时)。 $\\mathit{A}(m,n)=\\mathit{A}(m-1,\\math",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB2144"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "阿克曼(Ackermann)函数 $A(m,n)$ 中,$m, n$ 定义域是非负整数($m \\le 3$,$n \\le 10$),函数值定义为:\n\n$\\mathit{A}(m,n)=n+1$;($m=0$ 时)。\n\n$\\mathit{A}(m,n)=\\mathit{A}(m-1,1)$;($m>0$、$n=0$ 时)。\n\n$\\mathit{A}(m,n)=\\mathit{A}(m-1,\\math...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments