Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
158921 张蔚林 22第n项的数 C++ Accepted 2 MS 284 KB 283 2026-08-23 13:32:23

Tests(5/5):


Code:

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