Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138150 袁龙浩 阶乘的和 C++ Compile Error 0 MS 0 KB 455 2025-11-23 15:16:40

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int sum(int b){ int s=0; for(int j=b;j>=1;j--){ for(int i=1;i<=b;i++){ s+=(i*j); } cout<<s; return s; } int main(){ int n; cin>>n; sum(n); return 0; }


Run Info:

Main.cc: In function 'int sum(int)':
Main.cc:16:11: error: a function-definition is not allowed here before '{' token
 int main(){
           ^
Main.cc:21:1: error: expected '}' at end of input
 }
 ^
Main.cc:21:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^