Quiz 1

Ackerman函數

A(m, n)定義為

  1. n+1, if m = 0
  2. A(m-1, 1), if n = 0
  3. A(m-1, A(m, n-1)), otherwise

寫出遞迴函數

Input / Output Sample

A(0, 0) = 1
A(0, 1) = 2
A(0, 2) = 3
A(0, 3) = 4
A(0, 4) = 5
A(0, 5) = 6
A(1, 0) = 2
A(1, 1) = 3
A(1, 2) = 4
A(1, 3) = 5
A(1, 4) = 6
A(2, 0) = 3
A(2, 1) = 5
A(2, 2) = 7
A(2, 3) = 9
A(3, 0) = 5
A(3, 1) = 13
A(3, 2) = 29
A(4, 0) = 13
A(4, 1) = 65533 => 這要等一會~ღ ʕ̡̢̡•̫͡•ʔ̢̡̢ ღ

測驗規定

  • 檔名:quiz1.c
  • 要檔頭!
  • 輸入兩數字,輸出一結果即可
  • 缺席者,請向 TA 說明理由

輸入:兩整數

輸出:一結果

執行範例: