rt,这是这个系列的第一部分
1.10!次(阶乘,为300多万次运行)
#include<bits/stdc++.h>
using namespace std;
void h1(int k){
if(k<=1) return;
for(int i=1;i<=k;i++) h1(k-1);
}
int main(){
h1(10);
}
2.(10!)!次(大约为10^10^5次)
#include<bits/stdc++.h>
using namespace std;
void h1(int k){
if(k<=1) return;
for(int i=1;i<=k;i++) h1(k-1);
}
int main(){
h1(h1(10));
}
3.(......(10!)!)!......)(10次)(大约为10^10^10^10^10^10^10^10^10次)
#include<bits/stdc++.h>
using namespace std;
void h1(int k){
if(k<=1) return;
for(int i=1;i<=k;i++) h1(k-1);
}
void h2(int k){
if(k<=0) return;
h1(h2(k-1));
}
int main(){
h2(10);
}
4.大约f4(10)次
#include<bits/stdc++.h>
using namespace std;
void h1(int k){
if(k<=1) return;
for(int i=1;i<=k;i++) h1(k-1);
}
void h2(int k){
if(k<=0) return;
h1(h2(k-1));
}
void h3(int k){
if(k<=0) return;
h2(h3(k-1));
}
int main(){
h3(10);
}
5.大约fω(10)次(实际上是~f12(10)次)
#include<bits/stdc++.h>
using namespace std;
void h1(int k){
if(k<=1) return;
for(int i=1;i<=k;i++) h1(k-1);
}
void h2(int k,int p){
if(p==1) h1(k);
if(k==1) h2(p,p-1);
h2(h2(k-1,p),p-1);
}
int main(){
h2(10,10);
}
6.大约fω+1(10)次
#include<bits/stdc++.h>
using namespace std;
void h1(int k){
if(k<=1) return;
for(int i=1;i<=k;i++) h1(k-1);
}
void h2(int k,int p){
if(p==1) h1(k);
if(k==1) h2(p,p-1);
h2(h2(k-1,p),p-1);
}
void h3(int k){
if(k<=0) return;
h2(h2(k-1,k-1),h2(k-1,k-1));
}
int main(){
h2(10,10);
}
Tips:如果把这里的10改为65,那么已经超过了G(64)
未完待续......