| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 147471 | 孔声豪 | 求序列的前n项和 | C++ | Compile Error | 0 MS | 0 KB | 225 | 2026-02-05 12:26:19 |
#include<iostream> using namespace std; int main(){ int a=1,b=2;c,n,sum=0,i; cin>>n; for(i=1;i<=n;i++){ c=a+b; sum+=c; a=b; b=c; } cout<<sum<<endl; return 0; }
Main.cc: In function 'int main()':
Main.cc:4:16: error: 'c' was not declared in this scope
int a=1,b=2;c,n,sum=0,i;
^
Main.cc:4:18: error: 'n' was not declared in this scope
int a=1,b=2;c,n,sum=0,i;
^
Main.cc:4:20: error: 'sum' was not declared in this scope
int a=1,b=2;c,n,sum=0,i;
^
Main.cc:4:26: error: 'i' was not declared in this scope
int a=1,b=2;c,n,sum=0,i;
^