Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
83929 石晋骁 阶乘的和 C++ Compile Error 0 MS 0 KB 304 2024-07-15 10:03:02

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int sum(int)':
Main.cc:12:11: error: a function-definition is not allowed here before '{' token
 int main(){
           ^
Main.cc:4:6: warning: unused variable 'a' [-Wunused-variable]
  int a = 1,b = 0;
      ^
Main.cc:4:12: warning: unused variable 'b' [-Wunused-variable]
  int a = 1,b = 0;
            ^
Main.cc:20:1: error: expected '}' at end of input
 }
 ^
Main.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]