递归一万层没问题
运行下面这段程序:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int depth(int n) {
if (n == 0) return 1;
return 1 + depth(n - 1);
}
int main() {
cout << depth(10000) << endl;
}
(本题用 g++ -std=c++17 -O0 编译。)
全部评论