Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
144035 唐诗阳 22第n项的数 C++ Compile Error 0 MS 0 KB 661 2026-01-18 15:52:00

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 s(int x,int y[10001]){ if(y[2]-y[1]==y[3]-y[2]){ return y[1]+(x-1)*(y[2]-y[1]); } else if(y[2]/y[1]==y[3]/y[2]){ int i; int b=y[2]/y[;1] for(int i=x;i>5;i--){ b*=y[2]/y[1]; } return b*y[4]; } } int main(){ int n,x[10001]; cin>>n; for(int i=1;i<=4;i++){ cin>>x[i]; } cout<<s(n,x); return 0; }


Run Info:

Main.cc: In function 'int s(int, int*)':
Main.cc:12:22: error: expected primary-expression before ';' token
         int b=y[2]/y[;1]
                      ^
Main.cc:12:22: error: expected ']' before ';' token
Main.cc:12:24: error: expected ';' before ']' token
         int b=y[2]/y[;1]
                        ^
Main.cc:13:20: warning: statement has no effect [-Wunused-value]
         for(int i=x;i>5;i--){
                    ^
Main.cc:13:22: warning: statement has no effect [-Wunused-value]
         for(int i=x;i>5;i--){
                      ^
Main.cc:13:28: error: expected ';' before ')' token
         for(int i=x;i>5;i--){
                            ^
Main.cc:18:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^