Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
76759 彭慕允 数列求和 C++ Compile Error 0 MS 0 KB 255 2024-06-02 17:24:34

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; long long s[n+1]; a[1]=1; for(int i=0; i<=n; i++) { a[i]=a[i-1]*2; } long long sum=0; for(int i=1; i<=n; i++) { sum+=a[i]; } cout<<sum; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:2: error: 'a' was not declared in this scope
  a[1]=1;
  ^
Main.cc:7:12: warning: unused variable 's' [-Wunused-variable]
  long long s[n+1];
            ^