Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
197 | 刘家源 | n的阶乘 | C++ | Accepted | 0 MS | 256 KB | 364 | 2022-07-22 09:16:55 |
#include<iostream> #include<cstdio> #include<string> #include<iomanip> #include<cmath> using namespace std; int jieceng(int x)//x是形式参数只在自定义函数起作用 { if(x==1) return 1; else return jieceng(x-1)*x;//递归函数的关系式 } int main(){ int x; cin>>x; cout<<jieceng(x); return 0; }