Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
156019 陈骏睿 数列求和 C++ Compile Error 0 MS 0 KB 481 2026-06-20 09:47:48

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ long long a[51]={1,2,4},n,x=a[1]/a[0]; cin>>n; for(int i=3,i<=n;i++){ long long a[i]=q*a[i-1]; } for(int i=0;i<n;i++){ sum+=a[i]; } cout<<sum; cout<<a[n]; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:10:18: error: expected ';' before '<=' token
     for(int i=3,i<=n;i++){
                  ^
Main.cc:10:18: error: expected primary-expression before '<=' token
Main.cc:11:24: error: 'q' was not declared in this scope
         long long a[i]=q*a[i-1];
                        ^
Main.cc:14:9: error: 'sum' was not declared in this scope
         sum+=a[i];
         ^
Main.cc:16:11: error: 'sum' was not declared in this scope
     cout<