Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
144512 翁思宸 22第n项的数 C++ Compile Error 0 MS 0 KB 408 2026-01-23 18:36:44

Tests(0/0):


Code:

//1378 22第n项的数 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; int main(){ int n,a[101]; cin>>n; for(int i=1;i<=4;i++){ cin>>a[i]; } int b=a[2]/a[1],c=a[4]/a[3]; if(b==c){ num=a[1]*pow(a[2]/a[1],n-1); } else { num=a[1]+(a[2]-a[1])*(n-1); } cout<<num<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:9: error: 'num' was not declared in this scope
         num=a[1]*pow(a[2]/a[1],n-1);
         ^
Main.cc:18:9: error: 'num' was not declared in this scope
         num=a[1]+(a[2]-a[1])*(n-1);
         ^
Main.cc:20:11: error: 'num' was not declared in this scope
     cout<