Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
120118 何辰熠 22第n项的数 C++ Accepted 1 MS 280 KB 328 2025-05-24 10:24:02

Tests(5/5):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int a,b[4],c1,c2; float x; cin>>a; for(int i=0;i<4;i++) { cin>>b[i]; } c1=b[1]-b[0]; c2=b[3]-b[2]; x=b[1]/b[0]; if(c1==c2) { cout<<b[0]+c1*(a-1); } else { cout<<int(b[0]*pow(x,(a-1))); } return 0; }