Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
76758 何嘉欢 数列求和 C++ Compile Error 0 MS 0 KB 233 2024-06-02 17:24:30

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:5: error: expected identifier before numeric constant
  a=[1]=1;
     ^
Main.cc: In lambda function:
Main.cc:7:7: error: expected '{' before '=' token
  a=[1]=1;
       ^
Main.cc: In function 'int main()':
Main.cc:7:7: error: no match for 'operator=' (operand types are 'main()::' and 'int')
Main.cc:7:6: note: candidate: main()::& main()::::operator=(const main()::&) 
  a=[1]=1;
      ^
Main.cc:7:6: note:   no known conversion for argument 1 from 'int' to 'const main()::&'