This commit is contained in:
e2hang
2025-07-17 15:57:49 +08:00
parent 2ed81d2e89
commit 8f1dabc334
5 changed files with 18 additions and 2 deletions

View File

@@ -1,6 +1,21 @@
#include <iostream> #include <iostream>
#include <cmath>
using namespace std; using namespace std;
int main(){
int ack(int i, int j){
if(i == 1 && j >= 1)
return pow(2,j);
if(i >=2 && j == 1)
return ack(i - 1, 2);
if(i >= 2 && j >= 2)
return ack(i - 1, ack(i, j - 1));
return 0;
}
int main(){
cout << "1,2: " << ack(1,2) << endl;
cout << "2,1: " << ack(2,1) << endl;
cout << "2,2: " << ack(2,2) << endl;
cout << "1,3: " << ack(1,3) << endl;
return 0; return 0;
} }

Binary file not shown.

1
Recursion/P29_23_GCD.cpp Normal file
View File

@@ -0,0 +1 @@
#include <iostream>