Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
193 | 邓小龙 | n的阶乘 | C++ | Accepted | 0 MS | 260 KB | 343 | 2022-07-22 09:14:19 |
#include<iostream> using namespace std; int jiecheng(int x) //x是形式参数,只在自定义函数内起作用 { if(x==1) //递归函数的结束条件 return 1; else return jiecheng(x-1)*x;//递归函数的关系式 } int main(){ int x; cin>>x; cout<<jiecheng(x); return 0; }