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

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int sum(int m){ int a = 1; for(int j = 1;j <= i;j++){ a = a*i; } return 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:5:21: error: 'i' was not declared in this scope
  for(int j = 1;j <= i;j++){
                     ^