Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
66659 黎瑾萱 阶乘的和 C++ Accepted 1 MS 272 KB 272 2024-03-09 17:37:21

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; //定义函数 int sum(int a){ int b=1; for(int i=1;i<=a;i++){ b *= i; } return b;//返回值。 } int main(){ int n,m=0; cin>>n; for(int j=1;j<=n;j++){ m += sum(j); } cout<<m; }