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

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],sum=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; 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:8:31: warning: unused variable 'x' [-Wunused-variable]
     long long a[51]={1,2,4},n,x=a[1]/a[0],sum=0;
                               ^