阶乘的递归写法 int fact(int n) { int res = 1; if (n == 1) res = n; else res = fact(n - 1) * n; return res; } 用栈改写的非递归写法 #include<iostream> #include<cstdlib> typedef long long ll; using namespace std; struct node {