Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
324970 | 沈心 | 【C2-2】阶乘 | C++ | 通过 | 100 | 2 MS | 252 KB | 219 | 2025-06-01 13:27:39 |
#include<iostream> using namespace std; int main(){ long long n,i=1,s=1; cin>>n; if (n==0){ cout<<s<<endl; } else if(n!=0){ while (i<=n){ s=s*i; i++; } cout<<s<<endl; } return 0; }