Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
97636 | 王思颜 | 阶乘的和 | C++ | Accepted | 1 MS | 272 KB | 267 | 2024-11-16 11:41:16 |
#include<bits/stdc++.h> using namespace std; int he(int b){ int ans = 1; for (int i = 1;i <= b;i++){ ans = ans * i; } return ans; } int main(){ int n,a = 0; cin>>n; for (int j = 1;j <= n;j++){ a += he(j); } cout<<a<<endl; return 0; }