CJ/Project1/阿克曼.cpp

30 lines
594 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//#include <iostream>
//using namespace std;
//
//int akm(int m, int n) {
// if (m == 0) {
// return n + 1;
// }
// else if (n == 0) {
// return akm(m - 1, 1);
// }
// else {
// return akm(m - 1, akm(m, n - 1));
// }
//}
//
//int main() {
// int m, n;
// cout << "请输入 m 和 nm <= 3n <= 10";
// cin >> m >> n;
//
// if (m < 0 || n < 0 || m > 3 || n > 10) {
// cout << "输入超出范围!" << endl;
// }
// else {
// cout << "Ackermann(" << m << ", " << n << ") = " << akm(m, n) << endl;
// }
//
// return 0;
//}